question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm update fails in CRA app after node-sass

See original GitHub issue

Describe the bug

After the install of node-sass in a newly create CRA app, npm update fails with below error.

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.3" 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.3" 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.13.12
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 C:\Users\peter\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\peter\AppData\Local\npm-cache\_logs\2021-03-25T20_42_43_029Z-debug.log

Did you try recovering your dependencies?

Yes, cleared npm cache and setup new project.

Environment

- create-react-app version: 4.0.3
- NPM version: 7.7.4
- Node version: v14.16.0
- Node Process: {
  node: '14.16.0',
  v8: '8.4.371.19-node.18',
  uv: '1.40.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.16.1',
  modules: '83',
  nghttp2: '1.41.0',
  napi: '7',
  llhttp: '2.1.3',
  openssl: '1.1.1j',
  cldr: '37.0',
  icu: '67.1',
  tz: '2020a',
  unicode: '13.0'
}
- Node Platform: win32
- Node architecture: x64
- node-sass version: 
    node-sass       5.0.0   (Wrapper)       [JavaScript]
    libsass         3.5.5   (Sass Compiler) [C/C++]

- npm node-sass versions:
├── node-sass@5.0.0
└─┬ react-scripts@4.0.3
  └─┬ sass-loader@10.1.1
    └── node-sass@5.0.0 deduped

Steps to reproduce

  1. npx create-react-app test3 typescript --use-npm
  2. npm install node-sass
  3. npm update

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:15

github_iconTop GitHub Comments

44reactions
RusimbiPatrickcommented, Mar 27, 2021

This is an issue in npm version 7+. @petersowa and @SirPryderi. You will need to downgrade your npm versions to the stable 6.14.11

Solution: npm install npm@6.14.11 -g

19reactions
paramore2kcommented, Apr 8, 2021

Updated to the newest version of NPM and added npm install --save-dev @babel/core. No more update fails with node-sass.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve this npm install error? Should I update node ...
@AKX In VSCode I search for node-sass, seems like I did not use it in any ReactJs files. Do you think it's safe...
Read more >
error: node sass version 7.0.1 is incompatible with ^4.0.0.
after serving project by ng serve. Tried to downgrade versions of nod and npm but result is the same. And it seems it...
Read more >
'node-sass' version 5.0.0 is incompatible with ^4.0.0-Reactjs
This error is due to an incompatible version of the sass loader with node-sass. Add these dependencies at the end of your package.json...
Read more >
node-sass: Command failed when running npm install [Solved]
To solve the error node-sass: Command failed error, use the `sass` package instead of the deprecated `node-sass` module. Alternatively, install a version of ......
Read more >
react-scripts - npm
Configuration and scripts for Create React App.. Latest version: 5.0.1, last published: 9 months ago. Start using react-scripts in your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found