create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

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

Open kyeltech opened this issue 6 years ago • 29 comments

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

kyeltech avatar Dec 05 '19 14:12 kyeltech

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.

rosbel avatar Dec 05 '19 14:12 rosbel

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.

nksharma192 avatar Dec 05 '19 15:12 nksharma192

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.

CRHarding avatar Dec 05 '19 17:12 CRHarding

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.

pierzbarry avatar Dec 05 '19 18:12 pierzbarry

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

maddyrombes avatar Dec 05 '19 19:12 maddyrombes

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.

dimitrihartt avatar Dec 05 '19 19:12 dimitrihartt

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

heyimalex avatar Dec 05 '19 19:12 heyimalex

Yes @heyimalex

maddyrombes avatar Dec 05 '19 19:12 maddyrombes

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

heyimalex avatar Dec 05 '19 19:12 heyimalex

Yep @heyimalex

CRHarding avatar Dec 05 '19 19:12 CRHarding

  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

maddyrombes avatar Dec 05 '19 19:12 maddyrombes

 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

CRHarding avatar Dec 05 '19 19:12 CRHarding

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

heyimalex avatar Dec 05 '19 20:12 heyimalex

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.

maddyrombes avatar Dec 05 '19 20:12 maddyrombes

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.

heyimalex avatar Dec 05 '19 20:12 heyimalex

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

maddyrombes avatar Dec 05 '19 20:12 maddyrombes

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.

heyimalex avatar Dec 05 '19 20:12 heyimalex

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 avatar Dec 05 '19 21:12 maddyrombes

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

maddyrombes avatar Dec 05 '19 21:12 maddyrombes

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);

maddyrombes avatar Dec 05 '19 21:12 maddyrombes