1

I'm trying to install create-react-app in my project, but a package.json without a start script is generated, and I get an error "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." As recommended in other questions regarding this issue, here's what I've already tried: npm uninstall -g create-react-app, which create-react-app then rm -rf [the path that was listed] (now when I enter which create-react-appit says which: no create-react-app in ....., and restarted my computer.

I don't know what else to try. Any help appreciated.

Here is my full error message/what I get when trying to run create-react-app:

$ npx create-react-app client

Creating a new React app in C:\Users\deja\Desktop\repos\devconnect\client.

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

yarn add v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "win32" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 154 new dependencies.
info Direct dependencies
├─ react-dom@16.12.0
├─ react-scripts@3.3.0
└─ react@16.12.0
info All dependencies
├─ @babel/helpers@7.7.4
├─ @babel/plugin-proposal-async-generator-functions@7.7.4
├─ @babel/plugin-proposal-class-properties@7.7.4
├─ @babel/plugin-proposal-decorators@7.7.4
├─ @babel/plugin-proposal-dynamic-import@7.7.4
├─ @babel/plugin-proposal-json-strings@7.7.4
├─ @babel/plugin-proposal-nullish-coalescing-operator@7.7.4
├─ @babel/plugin-proposal-numeric-separator@7.7.4
├─ @babel/plugin-proposal-object-rest-spread@7.7.4
├─ @babel/plugin-proposal-optional-catch-binding@7.7.4
├─ @babel/plugin-proposal-optional-chaining@7.7.4
├─ @babel/plugin-proposal-unicode-property-regex@7.7.4
├─ @babel/plugin-syntax-decorators@7.7.4
├─ @babel/plugin-syntax-flow@7.7.4
├─ @babel/plugin-syntax-nullish-coalescing-operator@7.7.4
├─ @babel/plugin-syntax-numeric-separator@7.7.4
├─ @babel/plugin-syntax-optional-chaining@7.7.4
├─ @babel/plugin-syntax-top-level-await@7.7.4
├─ @babel/plugin-syntax-typescript@7.7.4
├─ @babel/plugin-transform-arrow-functions@7.7.4
├─ @babel/plugin-transform-async-to-generator@7.7.4
├─ @babel/plugin-transform-block-scoped-functions@7.7.4
├─ @babel/plugin-transform-block-scoping@7.7.4
├─ @babel/plugin-transform-classes@7.7.4
├─ @babel/plugin-transform-computed-properties@7.7.4
├─ @babel/plugin-transform-destructuring@7.7.4
├─ @babel/plugin-transform-dotall-regex@7.7.4
├─ @babel/plugin-transform-duplicate-keys@7.7.4
├─ @babel/plugin-transform-exponentiation-operator@7.7.4
├─ @babel/plugin-transform-flow-strip-types@7.7.4
├─ @babel/plugin-transform-for-of@7.7.4
├─ @babel/plugin-transform-function-name@7.7.4
├─ @babel/plugin-transform-literals@7.7.4
├─ @babel/plugin-transform-member-expression-literals@7.7.4
├─ @babel/plugin-transform-modules-amd@7.7.5
├─ @babel/plugin-transform-modules-commonjs@7.7.5
├─ @babel/plugin-transform-modules-systemjs@7.7.4
├─ @babel/plugin-transform-modules-umd@7.7.4
├─ @babel/plugin-transform-named-capturing-groups-regex@7.7.4
├─ @babel/plugin-transform-new-target@7.7.4
├─ @babel/plugin-transform-object-super@7.7.4
├─ @babel/plugin-transform-parameters@7.7.4
├─ @babel/plugin-transform-property-literals@7.7.4
├─ @babel/plugin-transform-react-display-name@7.7.4
├─ @babel/plugin-transform-react-jsx-self@7.7.4
├─ @babel/plugin-transform-react-jsx-source@7.7.4
├─ @babel/plugin-transform-react-jsx@7.7.4
├─ @babel/plugin-transform-regenerator@7.7.5
├─ @babel/plugin-transform-reserved-words@7.7.4
├─ @babel/plugin-transform-runtime@7.7.4
├─ @babel/plugin-transform-shorthand-properties@7.7.4
├─ @babel/plugin-transform-spread@7.7.4
├─ @babel/plugin-transform-sticky-regex@7.7.4
├─ @babel/plugin-transform-template-literals@7.7.4
├─ @babel/plugin-transform-typeof-symbol@7.7.4
├─ @babel/plugin-transform-typescript@7.7.4
├─ @babel/plugin-transform-unicode-regex@7.7.4
├─ @babel/preset-env@7.7.4
├─ @babel/preset-react@7.7.4
├─ @babel/preset-typescript@7.7.4
├─ @csstools/normalize.css@10.1.0
├─ @svgr/babel-plugin-svg-dynamic-title@4.3.3
├─ @svgr/babel-preset@4.3.3
├─ @svgr/core@4.3.3
├─ @svgr/webpack@4.3.3
├─ @types/events@3.0.0
├─ @types/glob@7.1.1
├─ @types/minimatch@3.0.3
├─ @types/node@12.12.21
├─ @types/parse-json@4.0.0
├─ @typescript-eslint/eslint-plugin@2.12.0
├─ @typescript-eslint/parser@2.12.0
├─ aggregate-error@3.0.1
├─ async@2.6.3
├─ babel-plugin-macros@2.7.1
├─ babel-plugin-named-asset-import@0.3.5
├─ babel-preset-react-app@9.1.0
├─ cacache@13.0.1
├─ clean-stack@2.2.0
├─ compression@1.7.4
├─ confusing-browser-globals@1.0.9
├─ connect-history-api-fallback@1.6.0
├─ core-js@3.5.0
├─ css-loader@3.2.0
├─ del@4.1.1
├─ dotenv@8.2.0
├─ electron-to-chromium@1.3.322
├─ eslint-config-react-app@5.1.0
├─ eslint-loader@3.0.2
├─ eslint-plugin-react@7.16.0
├─ eslint@6.7.2
├─ espree@6.1.2
├─ express@4.17.1
├─ file-loader@4.3.0
├─ fork-ts-checker-webpack-plugin@3.1.0
├─ html-entities@1.2.1
├─ http-proxy-middleware@0.19.1
├─ indent-string@4.0.0
├─ internal-ip@4.3.0
├─ is-absolute-url@3.0.3
├─ is-path-cwd@2.2.0
├─ is-path-in-cwd@2.1.0
├─ is-path-inside@2.1.0
├─ jest-watch-typeahead@0.4.2
├─ killable@1.0.1
├─ lines-and-columns@1.1.6
├─ loglevel@1.6.6
├─ minipass-collect@1.0.2
├─ minipass-flush@1.0.5
├─ minipass-pipeline@1.2.2
├─ minipass@3.1.1
├─ node-forge@0.9.0
├─ node-releases@1.1.43
├─ open@7.0.0
├─ opn@5.5.0
├─ optionator@0.8.3
├─ p-map@2.1.0
├─ p-retry@3.0.1
├─ path-is-inside@1.0.2
├─ portfinder@1.0.25
├─ postcss-modules-local-by-default@3.0.2
├─ postcss-modules-values@3.0.0
├─ postcss-normalize@8.0.1
├─ promise@8.0.3
├─ raf@3.4.1
├─ react-app-polyfill@1.0.5
├─ react-dev-utils@10.0.0
├─ react-dom@16.12.0
├─ react-error-overlay@6.0.4
├─ react-scripts@3.3.0
├─ react@16.12.0
├─ resolve-url-loader@3.1.1
├─ retry@0.12.0
├─ sanitize.css@10.0.0
├─ sass-loader@8.0.0
├─ scheduler@0.18.0
├─ selfsigned@1.10.7
├─ serialize-javascript@2.1.2
├─ serve-index@1.9.1
├─ shell-quote@1.7.2
├─ sockjs-client@1.4.0
├─ spdy@4.0.1
├─ ssri@7.1.0
├─ terser-webpack-plugin@2.2.1
├─ terser@4.4.3
├─ ts-pnp@1.1.5
├─ url-loader@2.3.0
├─ webpack-dev-middleware@3.7.2
├─ webpack-dev-server@3.9.0
├─ webpack-manifest-plugin@2.2.0
├─ webpack@4.41.2
├─ whatwg-fetch@3.0.0
├─ word-wrap@1.2.3
└─ yaml@1.7.2
Done in 86.09s.

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.
nCardot
  • 5,992
  • 6
  • 47
  • 83

6 Answers6

3

So the best thing to do is to remove create-react-app globally using npm uninstall create-react-app -g or yarn global remove create-react-app because that is likely the reason you're seeing this error message:

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.

Once you've removed it, please note you don't need to install create-react-app globally to initialize a new project, its recommended you use the npx package runner tool that comes with at least node 5.2 and above. So npx will basically allow you to run a package without installing it, so on your case create-react-app.

So to create a new project, just type in : npx create-react-app myapp and that will initialize your react app.

Cozy
  • 311
  • 5
  • 16
  • As I mentioned in my question, I already tried `npm uninstall create-react-app -g` and that didn't resolve the error. I am using `npx` to run `create-react-app` as well. – nCardot Dec 18 '19 at 21:41
  • 1
    see this answer similar to your question https://stackoverflow.com/a/59189242/7744772 . If you are using yarn also make sure you do `yarn global remove create-react-app` – Cozy Dec 18 '19 at 22:09
  • 1
    yarn global remove create-react-app solved the problem, thanks! – nCardot Dec 18 '19 at 22:26
  • still i am getting the same error – Mahad Ali Feb 25 '22 at 03:59
2

I think @Cozy is right. I got the same issue. But I can't uninstall my create-react-app command by running

npm uninstall create-react-app -g

What I did is run this command to remove create-react-app

which create-react-app | xargs rm

And then use npx to create a new project

npx create-react-app new-app

Hope it helps :)

Aaron Guo
  • 25
  • 9
0

the reason why this happened is because you ran npm update -g create-react-app after restarting your computer. Uninstall again then create the application again using npx create-react-app name-of-my-app

laserany
  • 1,257
  • 1
  • 8
  • 17
  • I only tried `npm update -g create-react-app` because I was getting the same error after trying `npm uninstall -g create-react-app, which create-react-app then rm -rf [the path that was listed]` and restarting. I just tried to do the global uninstall again and I'm still getting the same error. – nCardot Dec 18 '19 at 21:40
  • 1
    In this case if i were you i would just reinstall node.js – laserany Dec 18 '19 at 21:42
  • Reinstalling node with the .msi Windows file didn't work. This is what solved the problem: yarn global remove create-react-app – nCardot Dec 18 '19 at 22:27
0

If you are familiar with the old create-react-app, try this.

First, open cmd and type this:
npm uninstall -g create-react-app
Create a folder env in C: drive. Then, create a bin folder inside it.
Now add a file called create-react-app.bat.
Edit it with notepad and copy and paste this inside it.

npm init react-app

Save it.
Now, right click on This PC or My Computer and click Properties.
Now click Advanced System Settings.
Click on Environment Variables.
In System Variables, Find Path.
Now Click Edit.
After the new Dialog Box appears, Click add.
Now Paste this:
C:\env\bin
Now create-react-app should work.

Stubborn
  • 995
  • 4
  • 17
  • 30
0

I resolved this issue just by following two steps:

Go to the terminal type the following command line

  1. rm -rf /usr/local/bin/create-react-app.

This will remove create-react-app manually.

Now start creating the new app

  1. npx create-react-app my-app
0

I would uninstall create-react-app globally by this command:

npm uninstall -g create-react-app

npm install create-react-app@latest

npx create-react-app my-app

npx create-react-app my-app --template typescript

OR

Delete delete my users root node_module

npx --ignore-existing create-react-app

LAST, I found the folder in /usr/local/bin and I deleted the create-react-app file, and it worked.

heyfranksmile
  • 169
  • 1
  • 5