Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node_modules of generated React frontend cannot be installed with npm 7 #293

Open
Mweydert opened this issue Jun 2, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@Mweydert
Copy link

Mweydert commented Jun 2, 2021

On a newly created project with the generator, I am not able to install node_modules of a react frontend using npm 7.

result of npm i

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: typescript@4.3.2
npm ERR! node_modules/typescript
npm ERR!   typescript@"^4.0.3" from the root project
npm ERR!   peer 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" from tsutils@3.21.0
npm ERR!   node_modules/tsutils
npm ERR!     tsutils@"^3.21.0" from @typescript-eslint/eslint-plugin@4.26.0
npm ERR!     node_modules/@typescript-eslint/eslint-plugin
npm ERR!       dev @typescript-eslint/eslint-plugin@"^4.12.0" from the root project
npm ERR!       2 more (react-scripts, @thetribe/eslint-config-typescript)
npm ERR!     tsutils@"^3.21.0" from @typescript-eslint/typescript-estree@4.26.0
npm ERR!     node_modules/@typescript-eslint/typescript-estree
npm ERR!       @typescript-eslint/typescript-estree@"4.26.0" from @typescript-eslint/parser@4.26.0
npm ERR!       node_modules/@typescript-eslint/parser
npm ERR!         dev @typescript-eslint/parser@"^4.12.0" from the root project
npm ERR!         3 more (@typescript-eslint/eslint-plugin, react-scripts, @thetribe/eslint-config-typescript)
npm ERR!       1 more (@typescript-eslint/experimental-utils)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1" from react-scripts@4.0.1
npm ERR! node_modules/react-scripts
npm ERR!   react-scripts@"4.0.1" 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 ERR!
npm ERR! See /Users/mweydert/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mweydert/.npm/_logs/2021-06-02T12_32_54_667Z-debug.log

npm 7 automatically try to install peer dependencies, which seems to cause issue be due to :

  • Dependency typescript: "^4.0.3" in our package.json
  • Dependency react-scripts@4.0.1 in our package.json, which has a peer dependency to typescript@"^3.2.1"

If I allow an upper minor version of react-scripts (i.e. react-scripts@^4.0.1) which is supposed to fix this error (facebook/create-react-app#9892), I got a new error with @babel/core module.

Result of npm i:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: @babel/core@7.12.3
npm ERR! node_modules/@babel/core
npm ERR!   @babel/core@"7.12.3" from react-scripts@4.0.3
npm ERR!   node_modules/react-scripts
npm ERR!     react-scripts@"^4.0.1" from the root project
npm ERR!   @babel/core@"^7.12.3" from @svgr/webpack@5.5.0
npm ERR!   node_modules/@svgr/webpack
npm ERR!     @svgr/webpack@"5.5.0" from react-scripts@4.0.3
npm ERR!     node_modules/react-scripts
npm ERR!       react-scripts@"^4.0.1" from the root project
npm ERR!   9 more (babel-jest, babel-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @babel/core@"^7.13.0" from @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.13.12
npm ERR! node_modules/@babel/preset-env/node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining
npm ERR!   @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@"^7.13.12" from @babel/preset-env@7.14.4
npm ERR!   node_modules/@babel/preset-env
npm ERR!     @babel/preset-env@"^7.12.1" from @svgr/webpack@5.5.0
npm ERR!     node_modules/@svgr/webpack
npm ERR!       @svgr/webpack@"5.5.0" from react-scripts@4.0.3
npm ERR!       node_modules/react-scripts
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 ERR!
npm ERR! See /Users/mweydert/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mweydert/.npm/_logs/2021-06-02T12_40_21_266Z-debug.log

This seems to be an issue in dependencies of react-scripts 4.0.3 itself:

  • react-scripts@4.0.3 requires `@babel/core@7.12.3``
  • react-scripts@4.0.3 requires @svgr/webpack@5.5.0, which requires @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@"^7.13.12" from @babel/preset-env@7.14.4, which requires @babel/core@"^7.13.0"
@Mweydert
Copy link
Author

Mweydert commented Jun 2, 2021

Follow analysis, it seems to be in progress in react-scripts repository (facebook/create-react-app#10797) and should be available in a next minor version.

Meanwhile, a workaround is to :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants