Unusual error when running create-react-app in terminal on Mac - reactjs

I have never had an error before running create-react-app, but when I have run it on my Mac today I keep getting the below error and have not been able to resolve it. I've tried updating node, Yarn, eslint, CRA, and also clearing the node cache and nothing works. Why is this error occurring and how can I resolve it so I can install create-react-app?
Creating a new React app in /Users/...
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.10.1
[1/4] ๐Ÿ” Resolving packages...
[2/4] ๐Ÿšš Fetching packages...
error eslint#5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "9.3.0"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /Users/johnwolfe/printPackageTest/printtest has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting printtest/ from /Users/johnwolfe/printPackageTest
Done.

Error
error eslint#5.6.0: The engine "node" is incompatible with this
module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "9.3.0"
error Found incompatible module
Question
Why is this error occurring and how can I resolve it so I can install
create-react-app?
Answer
You might consider updating your NodeJS version :) It's quite clear that it's an incompatible issue between your NodeJS and the create-react-app

I was facing the same issue, try to add "--use-npm" at the end of create react app commend.
create-react-app appname --use-npm
Happy hacking!

Related

Couldn't find any versions for "cra-template-typescript" that matches "latest" in our cache

Trying to follow this guide: How to Build a Simple React app With Express API but when running
npx create-react-app react-express-app --template typescript
I get this output:
npx: installed 98 in 12.964s
Creating a new React app in /home/aioobe/projects/daily-challenge-5/react-express-app.
error Could not open cafile: ENOENT: no such file or directory, open '/etc/pki/tls/certs/ca-bundle.crt'
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...
You appear to be offline.
Falling back to the local Yarn cache.
yarn add v1.22.4
error Could not open cafile: ENOENT: no such file or directory, open '/etc/pki/tls/certs/ca-bundle.crt'
[1/4] Resolving packages...
error Couldn't find any versions for "cra-template-typescript" that matches "latest" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact --offline react react-dom react-scripts cra-template-typescript --cwd /home/aioobe/projects/daily-challenge-5/react-express-app has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting react-express-app/ from /home/aioobe/projects/daily-challenge-5
Done.
Does anyone have any idea of what's going on here?
Did some more googling and someone suggested it was a network issue, so i fiddled with my VPN and it finally worked.
So, if you run into this, check that you have proper network connection working.

Impossible to create a new React project

I am trying to create a new react project (I work on Mac OS).
To do that, according the documentation, I enter this :
npx create-react-app bet-front
I obtain this error :
yarn add v1.3.2
[1/4] ๐Ÿ” Resolving packages...
[2/4] ๐Ÿšš Fetching packages...
error #typescript-eslint/eslint-plugin#2.24.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1".
error Found incompatible module
I updated my node version (here), I have now : v12.16.2
I updated npm version, I have now : 6.14.4
Despite these upgrades, I have the same errors to create a new react project. Do I have the right versions of these tools to create a new react project ? What can I do more ?
Edit 1
I already tried this without success, and same error : npm init react-app bet-front
Edit 2
I uninstalled node and npm and re installed it. And then retried the command to create a new React project. And no changes : same error about the #typescript-eslint/eslint-plugin#2.24.0.
I finally succeeded to create this new react project :
sudo npm i -g create-react-app
I do not know why it works using sudo ! usually I do not need it. Strange !
I came across the same issue after updating my node and npm versions. Used this link as guidance: https://phoenixnap.com/kb/update-node-js-version.
I didn't realize my nvm version was also out of date and finally was able to run create-react-app!
You can check your nvm version like so:
nvm -ls
Then check for the latest version available:
nvm ls-remote
Finally, install:
nvm install [version-number]
Hope this helps you as it did for me!

An unexpected error occurred: "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz: Request failed \"404 Not Found\"

When I try to create a new react app with create-react-app, I got the following:
ยป npx create-react-app my-order
Creating a new React app in /Users/ian/myproject/my-order.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.19.0
[1/4] ๐Ÿ” Resolving packages...
[2/4] ๐Ÿšš Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/ian/myproject/my-order/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /Users/ian/myproject/my-order has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
And my local environment information is like this:
ยป npx create-react-app --info
Environment Info:
System:
OS: macOS 10.14.6
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU # 2.50GHz
Binaries:
Node: 11.1.0 - /usr/local/bin/node
Yarn: 1.19.0 - ~/.yarn/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
Browsers:
Chrome: 80.0.3987.100
Firefox: 72.0.2
Safari: 12.1.2
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: 2.1.1
Anyone have any idea what's going on here?
Try
yarn install --registry=https://registry.yarnpkg.com/
it worked for me
Sometimes there is a problem accessing npmjs.com and installing scoped packages. Try to check https://status.npmjs.org/
If you use NVM, you might have this problem occur if you switched away from your primary nodejs version that you first had installed, so just change back if you can:
nvm use <original node installation's version>
But, if that doesn't work for you, then in your shoes I'd try reinstalling node directly from the website if I can't just use a non-NVM installation: https://nodejs.org/en/
For some people it seems they have an EACCESS error, and that might be fixed by changing their registry from http to https.
Example using NPM, rather than Yarn:
npm install --registry=https://registry.npmjs.org/
A similar problem: Cannot run npm install from nvm, but working well using source from https://nodejs.org/en/download/
Try with yarn install --registry=https://registry.yarnpkg.com/.
Hope it works!
Try this in your command:
yarn cache clean
yarn
and it will probably work...
I too get the error An unexpected error occurred: "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz: Request failed \"503 Service Unavailable\""
I changed from var to let in my code and It works fine.

create-react-app (Found incompatible module)

I have this problem on create-react-app
my node version 10.16.3
my npm version 6.9.0
npx create-react-app mac
Creating a new React app in /home/brian/Documentos/mac/mac.
warning You are using Node "13.0.0-nightly20190802452b393c1f" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.17.3
warning You are using Node "13.0.0-nightly20190802452b393c1f" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
[1/4] Resolving packages...
[2/4] Fetching packages...
error #babel/core#7.5.5: The engine "node" is incompatible with this module. Expected version ">=6.9.0". Got "13.0.0-nightly20190802452b393c1f"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /home/brian/Documentos/mac/mac has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting mac/ from /home/brian/Documentos/mac
Done.
create-react-app react-app --use-npm
This worked for me
It appears the node version you're using isn't compatible. Can you try using node 10 or 12? I suggest using nvm to manage the different node versions.
Many packages define an explicit node version in their package.json. For example, in #babel/core:
"engines": {
"node": ">=6.9.0"
},
It seems your node version: 13.0.0-nightly20190802452b393c1f isn't valud for these requirements.
You can see the source in yarn that handles this.
You can see here that it appears the semver package does not handle this:
import semver from "semver";
console.log(semver.satisfies("13.0.0", ">=6.9.0")); // true
console.log(semver.satisfies("13.0.0-nightly20190802452b393c1f", ">=6.9.0")); // false

Create-React-App Unexpected Connection Refused

I keep getting the below error when I try to simply create a new react app. I even set up fiddler on my computer and set my proxy to work with that but I am still getting the following error:
ECONNREFUSED 13.107.6.183:443
Click here for the complete log
$ create-react-app testmeup
Creating a new React app in C:\***\source\Dev\testmeup.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.15.2
[1/4] Resolving packages...
error An unexpected error occurred: "https://pkgs.dev.azure.com/AdmInvestorServices/_packaging/test/npm/registry/react: connect ECONNREFUSED 13.107.6.183:443".
info If you think this is a bug, please open a bug report with the information provided in "C:\\****\\source\\Dev\\testmeup\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\***\Dev\testmeup has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
This appears to be an issue with your proxy settings since when you're running create-react-app <app_name> yarn is unable to resolve the necessary dependencies to set up your new react project, namely: react, react-dom, and react-scripts.
Maybe you could try setting your proxy settings so you can install the necessary libraries create-react-app needs. According to yarn's documentation:
"For backward compatiibilty with npm, Yarn allows passing down npm configuration via environment variables."
So maybe you could try the following and seeing if this helps resolve your issue:
npm config set proxy <proxy_url>
npm config set https-proxy <proxy_url>
where the <proxy_url> is changed to work with your appropriate proxy. Then you can tell yarn to ignore ssl if necessary. Note: Use at your own discretion.
yarn config set strict-ssl false
npm config set <key> <value> sets npm environment variables which yarn can also utilize. In this particular case we are setting the proxy environment variables. Now simply try running the create-react-app command again and it should be able to proceed with setting up the new react project for you.
Hopefully that helps!

Resources