facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.75k stars 26.86k forks source link

react-scripts 4.0.1 errors out during npm install #9978

Open Alaricus opened 4 years ago

Alaricus commented 4 years ago

When using react-scripts version 4.0.0, attempting to run npm i causes an error. The following is then displayed:

npm ERR! Cannot read property 'matches' of undefined

This is specific to version 4.0.0, as everything installs fine with version 3.4.3.

Of note is the fact that the yarn installation works fine. (Sadly I do need to use npm when deploying.)

Here is what was run prior to the installation attempt:

rm -rf node_modules/ rm package-lock.json npm cache clear --force

Node version: 15.0.1, npm version: 7.0.7.

If this is relevant here's the entire dependency list:

"dependencies": { "@amcharts/amcharts4": "^4.10.9", "@amcharts/amcharts4-geodata": "^4.1.18", "react": "^17.0.1", "react-dom": "^17.0.1", "react-scripts": "4.0.0", "react-router-dom": "^5.2.0" }, "devDependencies": { "eslint": "^7.12.1", "eslint-config-airbnb": "^18.2.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0" },

Alaricus commented 3 years ago

A bit of an update now that npm 7.0.10 is out and provides more verbose errors:

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! Found: type-fest@0.8.1 npm ERR! node_modules/type-fest npm ERR! type-fest@"^0.8.1" from globals@12.4.0
npm ERR! node_modules/globals npm ERR! globals@"^12.1.0" from eslint@7.13.0 npm ERR! node_modules/eslint npm ERR! dev eslint@"^7.12.1" from the root project npm ERR! 15 more (eslint-config-airbnb, eslint-plugin-import, ...) npm ERR! globals@"^12.1.0" from @eslint/eslintrc@0.2.1 npm ERR! node_modules/@eslint/eslintrc npm ERR! @eslint/eslintrc@"^0.2.1" from eslint@7.13.0 npm ERR! node_modules/eslint npm ERR! dev eslint@"^7.12.1" from the root project npm ERR! 15 more (eslint-config-airbnb, eslint-plugin-import, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peerOptional type-fest@"^0.13.1" from @pmmmwh/react-refresh-webpack-plugin@0.4.2 npm ERR! node_modules/@pmmmwh/react-refresh-webpack-plugin npm ERR! @pmmmwh/react-refresh-webpack-plugin@"0.4.2" from react-scripts@4.0.0 npm ERR! node_modules/react-scripts npm ERR! react-scripts@"4.0.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

oserban commented 3 years ago

npm i -S type-fest solved the issue for me, but npm is definitely solving the wrong dependency/version on this one.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

Alaricus commented 3 years ago

Update: Same issue with 4.0.1

sushmitg commented 3 years ago

I am facing the same issue. Node.js v15

sushmitg commented 3 years ago

I found a temporary solution. I created a new react project npx create-react-app my-app then ran npm install in folder my-app which generated the node_modules folder. I simply copied this node_modules in my project folder and ran npm install to install rest of the dependencies, and it worked. Seems like issue is with rm -rf command. I recently created a new partition in Ubuntu, since then I am facing lot of file system realted issues, like while deleting files or folders. After some googling I found out that to delete files or folders I need to first move the file or folder to trash first and then remove it from there. May be rm-rf mimics the shift+del which is what gives me the errors in ubunut (just guessing). Hope this helps!

Alaricus commented 3 years ago

I found a temporary solution...

I'm actually experiencing this on Windows, and my partition has remained unchanged for several years. So it might be something else.

webdevbyjoss commented 3 years ago

I'm experiencing this on Mac OS, and my partition has remained unchanged for several years. So it is definitely something else.

PawelJ-PL commented 3 years ago

I am able to reproduce the problem as follows:

PawelJ-PL commented 3 years ago

Interesting. The problem from previous comment occurs with npm 7.4.3, but if i use npm 6.14.5 I'm able to install dependenices

PawelJ-PL commented 3 years ago

It looks, that in my case problem is related to npm 7 before 7.5.0 (released yesterday). Everything works with latest npm 6 (6.14.11) and with npm 7.5.0

ghost commented 3 years ago

Same issue with react-scripts 4.0.3 and npm 7.18.1

scrawfor commented 3 years ago

Same issue on 4.0.3 and npm 7.10

joseph-allen commented 3 years ago

Same on "react-scripts": "4.0.3", and npm version 7.4.3

joseph-allen commented 3 years ago

I fixed this on my machine by using yarn instead of npm, yarn version 1.22.10

median-man commented 2 years ago

same on "react-scripts": "4.0.3" and npm version 7.19.0

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.