Skip to content

"A template was not provided." error on fresh install #8085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kyeltech opened this issue Dec 5, 2019 · 29 comments
Closed

"A template was not provided." error on fresh install #8085

kyeltech opened this issue Dec 5, 2019 · 29 comments

Comments

@kyeltech
Copy link

kyeltech commented Dec 5, 2019

Hello world, I was working on my create app and i noticed it just stopped displaying the progress so I decided to re-run and I kept on having the same issues and felt maybe I should create a new app template which I went on with it and after some minute of thinking it's created I went back to it to start it stop but got a message that reads
A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported. and after trying to wrap my head around it I couldn't solve it and felt a need to go to you and hoping for a reply as soon as possible
THANKS

@rosbel
Copy link

rosbel commented Dec 5, 2019

What are you using to run create-react-app?
Take a look at the quick-start section: https://create-react-app.dev/docs/getting-started#quick-start

If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version.

@nksharma192
Copy link

nksharma192 commented Dec 5, 2019

Try unistalling create-react-app if you have installed it globally using npm uninstall -g create-react-app and then use npx create-react-app my-app. It should work.

@CRHarding
Copy link

I uninstalled create-react-app globally, upgraded npm and npx, but it's still throwing the 'A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.' warning.

@pierzbarry
Copy link

I have this problem as well! Everything was perfectly fine yesterday and then today it suddenly started saying the same warning that everyone else is getting whenever I try to create a react app. I have tried uninstalling and everything but nothing has worked so far.

@maddyrombes
Copy link

I have also uninstalled, reinstalled globally, and tried everything else on this recent thread, and my create-react app is still not working.

@dimitrihartt
Copy link

Pleeeeease! HELP! The Create-React-App is NOT working since the latest update released to 3.3.0 which happened hours ago. Please review this UPDATE.
I tried everything including upgrading Node, Uninstalling Global installations... etc.
It is just installing node-modules... (taking 4 minutes to go everytime) and package json.
I tried even with --template options...
I tried to downgrade to the very last working version, but still not working. It seems that it always tries to install the latest bugged version.

Please... Help.

@heyimalex
Copy link
Contributor

Just to be clear, you're all getting this error while creating new apps after typing npx create-react-app my_new_app?

@maddyrombes
Copy link

Yes @heyimalex

@heyimalex
Copy link
Contributor

What does the output of npx create-react-app --info say?

@CRHarding
Copy link

Yep @heyimalex

@maddyrombes
Copy link

  System:
    OS: macOS 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz
  Binaries:
    Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node
    Yarn: Not Found
    npm: 6.11.3 - ~/.nvm/versions/node/v12.2.0/bin/npm
  Browsers:
    Chrome: 78.0.3904.108
    Firefox: 70.0.1
    Safari: 13.0.3
  npmPackages:
    react: Not Found
    react-dom: Not Found
    react-scripts: Not Found
  npmGlobalPackages:
    create-react-app: 3.3.0

@CRHarding
Copy link

 System:
  OS: macOS 10.15.1
  CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
 Binaries:
  Node: 12.12.0 - /usr/local/bin/node
  Yarn: Not Found
  npm: 6.11.3 - /usr/local/bin/npm
 Browsers:
  Chrome: 78.0.3904.108
  Firefox: Not Found
  Safari: 13.0.3
 npmPackages:
  react: Not Found
  react-dom: Not Found
  react-scripts: Not Found
 npmGlobalPackages:
  create-react-app: 3.3.0

@heyimalex
Copy link
Contributor

After the A template was not provided. error there should be a line that says <...> has failed., could you print that here?

@heyimalex heyimalex changed the title create-react-app(not working) "A template was not provided." error on fresh install Dec 5, 2019
@maddyrombes
Copy link

the whole message:

A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.

@heyimalex
Copy link
Contributor

Ok, I kinda misunderstood how the code flowed. This is gonna be rough but could you try this for me:

  • Find your global install of create-react-app. Probably in something like /usr/local/lib/node_modules. You may be able to at least get close to by calling which create-react-app.
  • Find createReactApp.js and add a line at the beginning of the executeNodeScript function at the bottom of the file that looks like this console.log('init input data: ', JSON.stringify(data));
  • Run it again and tell me what that outputs.

@maddyrombes
Copy link

init input data:  ["/Users/[myusername]/coding/testytest","testytest",null,"/Users/[myusername]/coding",null]

@heyimalex
Copy link
Contributor

I'm discovering I really should have read the code before I dug into this :') I'm sorry. Could you just post the entire output of the install?

Since I can't reproduce this and you're already in createReactApp.js, it'd probably be faster if you tried getting to the bottom of this! Everything happens in that file. The gist is that the error happens because templateName on line 517 is null/undefined. You can just walk back up through the program and figure out why.

@maddyrombes
Copy link

haha yep, let me see what I can figure out. here's the entire output:

Creating a new React app in /Users/madelinerombes/coding/testytest.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...


> [email protected] install /Users/madelinerombes/coding/testytest/node_modules/chokidar/node_modules/fsevents
> node install

[fsevents] Success: "/Users/madelinerombes/coding/testytest/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" is installed via remote

> [email protected] install /Users/madelinerombes/coding/testytest/node_modules/jest-haste-map/node_modules/fsevents
> node install

[fsevents] Success: "/Users/madelinerombes/coding/testytest/node_modules/jest-haste-map/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" is installed via remote

> [email protected] postinstall /Users/madelinerombes/coding/testytest/node_modules/babel-runtime/node_modules/core-js
> node postinstall || echo "ignore"


> [email protected] postinstall /Users/madelinerombes/coding/testytest/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall /Users/madelinerombes/coding/testytest/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

+ [email protected]
+ [email protected]
+ [email protected]
added 1666 packages from 764 contributors and audited 904892 packages in 63.475s
found 0 vulnerabilities

init input data:  ["/Users/madelinerombes/coding/testytest","testytest",null,"/Users/madelinerombes/coding",null]

A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.

@maddyrombes
Copy link

maddyrombes commented Dec 5, 2019

verbose and template are null. let me look into where template is coming from

@maddyrombes
Copy link

the template being used is hiddenProgram.internalTestingTemplate, which is this:

const hiddenProgram = new commander.Command()
  .option(
    '--internal-testing-template <path-to-template>',
    '(internal usage only, DO NOT RELY ON THIS) ' +
      'use a non-standard application template'
  )
  .parse(process.argv);

@heyimalex
Copy link
Contributor

Hmm, that went away in this commit so definitely before 3.3.0 was released. Very weird since --info said version 3.3.0. What does the package.json above your createReactApp.js say in the version field?

@maddyrombes
Copy link

it's 3.0.1., weird! you'd think uninstalling and reinstalling would've done it. I'll play around...

@maddyrombes
Copy link

I mean the original error said that the -g doesn't work anymore, right? so do I delete the node module manually?

@maddyrombes
Copy link

maddyrombes commented Dec 5, 2019

Yep. So here's what I did.

  • remove create-react-app from node_modules from user root
  • npx create-react-app myapp works

thanks @heyimalex 😅

@heyimalex
Copy link
Contributor

For sure! Sorry I took such a roundabout path to figuring out what went wrong.

For anyone else running into this, try running:

npx --ignore-existing create-react-app

If installation succeeds, then you either have an older global version of create-react-app installed or you have an older version of create-react-app installed in a node_modules folder somewhere up your directory tree. Removing that should fix the issue!

@CRHarding
Copy link

@maddyrombes Thanks!!

@dimitrihartt
Copy link

Thanks!! Ive just erased my users root node_module and it worked!!! Glory to Jesus!

@codepandy
Copy link

another solution:
npm uninstall -g create-react-app
when I uninstall it,I can't find the folder in /usr/local/lib/node_modules;
but It is still failed.(npx --ignore-existing create-react-app can work.)
then I found the folder in /usr/local/bin ,I delete the create-react-app folder,
and it can work.

@AdamZaczek
Copy link

I stumbled upon this issue as well.

@lock lock bot locked and limited conversation to collaborators Dec 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants