create-react-app: react-scripts 4.0.1 errors out during npm install

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" },

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 16
  • Comments: 17

Most upvoted comments

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.

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

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

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