npm install fails with Conflicting peer dependency: react#16.14.0 - node.js

while trying to install dependencies for this project, npm install fails with
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ecommerce-app#0.1.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"latest" from the root project
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.11.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"latest" from the root project
npm ERR! peer #material-ui/core#"^4.0.0" from #material-ui/icons#4.11.2
npm ERR! node_modules/#material-ui/icons
npm ERR! #material-ui/icons#"latest" from the root project
npm ERR! 1 more (#material-ui/lab)
npm ERR! 10 more (react-dom, #material-ui/icons, #material-ui/lab, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! redux-form#"^8.3.6" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#16.14.0
npm ERR! node_modules/react
npm ERR! peer react#"^16.4.2" from redux-form#8.3.7
npm ERR! node_modules/redux-form
npm ERR! redux-form#"^8.3.6" 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/gergo/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/gergo/.npm/_logs/2022-03-17T17_37_09_399Z-debug-0.log
EDIT
when running npm install --force, I got this other error
npm ERR! 2 warnings generated.
npm ERR! In file included from ../src/libsass/src/values.cpp:3:
npm ERR! In file included from ../src/libsass/src/values.hpp:4:
npm ERR! ../src/libsass/src/ast.hpp:1614:25: warning: loop variable 'numerator' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
npm ERR! for (const auto numerator : numerators)
npm ERR! ^
npm ERR! ../src/libsass/src/ast.hpp:1614:14: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
npm ERR! for (const auto numerator : numerators)
npm ERR! ^~~~~~~~~~~~~~~~~~~~~~
npm ERR! &
npm ERR! ../src/libsass/src/ast.hpp:1616:25: warning: loop variable 'denominator' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
npm ERR! for (const auto denominator : denominators)
npm ERR! ^
npm ERR! ../src/libsass/src/ast.hpp:1616:14: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
npm ERR! for (const auto denominator : denominators)
npm ERR! ^~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! &
npm ERR! 2 warnings generated.
npm ERR! In file included from ../src/binding.cpp:1:
npm ERR! In file included from ../../nan/nan.h:56:
npm ERR! In file included from /Users/gergo/.node-gyp/17.4.0/include/node/node.h:63:
npm ERR! In file included from /Users/gergo/.node-gyp/17.4.0/include/node/v8.h:25:
npm ERR! In file included from /Users/gergo/.node-gyp/17.4.0/include/node/v8-array-buffer.h:12:
npm ERR! In file included from /Users/gergo/.node-gyp/17.4.0/include/node/v8-local-handle.h:12:
npm ERR! /Users/gergo/.node-gyp/17.4.0/include/node/v8-internal.h:563:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
npm ERR! !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR! ~~~~~^~~~~~~~~~~
npm ERR! remove_cv
npm ERR! /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits:697:50: note: 'remove_cv' declared here
npm ERR! template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
npm ERR! ^
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/Users/gergo/Documents/spring-boot-react-ecommerce-app/client/node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 19.6.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/17.4.0/bin/node" "/Users/gergo/Documents/spring-boot-react-ecommerce-app/client/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/gergo/Documents/spring-boot-react-ecommerce-app/client/node_modules/node-sass
npm ERR! gyp ERR! node -v v17.4.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
EDIT
the second error is thrown while installing node-sass. my node version was not compatible with "node-sass": "^4.14.1". I have changed node-sass version to be compatible with my node version and this error went away. and the build is successful

For first error I tried to install npm by below 2 command in Terminal one after another. It fixes for me:
npm install --legacy-peer-deps
npm audit fix --force`
*N.B: Don't forget to restart terminal after installing

You are getting errors because of the #material-ui/core which is deprecated see: https://www.npmjs.com/package/#material-ui/core
the new package for material-ui is https://www.npmjs.com/package/#mui/material.
As they say here https://mui.com/guides/migration-v4/#update-react-amp-typescript-version
The minimum supported version of React was increased from v16.8.0 to v17.0.0.
You should consider upgrading your react and material ui, they also changed styling tool to emotion, you'll find more info about in the link above.
Also, they have pretty good migration guides for cases like yours, check https://mui.com/components/data-grid/migration-v4/#migrating-mui-core-from-v4
Temporary alternative can be using force install(npm install --force) but I really recommend upgrading your dependencies as otherwise there are no warranties that things will work.

install the dependencies like this:
npm install <dependencyname> --force
or if you want to install all dependencies at once,
npm install --force

the second error is thrown while installing node-sass.
my node version (17.4) was not compatible with "node-sass": "^4.14.1"
I have changed node-sass version to be compatible with my node version and this error went away. and the build is successful.

Is it still failing? for me npm install works without an error using node version 14.16.0

You need to upgrade your node-sass version to be compatible with the current LTS version of Node.js.
To do this, change your package.json file to include the following (replacing the old declaration).
{
"dependencies": {
"node-sass": "^7.0.1"
}
}
Then, run the following command, and there should be no errors.
$ npm install
Ignore the $, it is just to indicate the terminal.

Try changing package management to yarn. At present, most packages already support yarn, and its dependency processing is better.
yarn install

Tried all the above solutions but when I Removed all the dependencies and install them one by one, It worked.

Related

Unable to NPM install/start on an angular project

I have been having this issue for many weeks now. I am unable to install/start this project after cloning from the repository.
When I use "npm start"
Could not find module "#angular-devkit/build-angular" from ...
When I use "npm i"
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: karma-jasmine-html-reporter#1.5.4
npm ERR! Found: jasmine-core#3.3.0
npm ERR! node_modules/jasmine-core
npm ERR! dev jasmine-core#"~3.3.0" from the root project
npm ERR! jasmine-core#"^3.3" from karma-jasmine#2.0.1
npm ERR! node_modules/karma-jasmine
npm ERR! dev karma-jasmine#"~2.0.1" from the root project
npm ERR! peer karma-jasmine#">=1.1" from karma-jasmine-html-reporter#1.5.4
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR! dev karma-jasmine-html-reporter#"^1.5.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core#">=3.5" from karma-jasmine-html-reporter#1.5.4
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR! dev karma-jasmine-html-reporter#"^1.5.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: jasmine-core#4.3.0
npm ERR! node_modules/jasmine-core
npm ERR! peer jasmine-core#">=3.5" from karma-jasmine-html-reporter#1.5.4
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR! dev karma-jasmine-html-reporter#"^1.5.4" from the root project
When I use "npm i --legacy-peer-deps"
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library
npm ERR! gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! Node-gyp failed to build your package.
npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
npm ERR! node-pre-gyp ERR! node -v v16.13.2
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.13.0
npm ERR! node-pre-gyp ERR! not ok
What I have done
I have reinstall node
Delete package-lock.json/package.json and then "npm i"
Reclone the git repostory
Reinstall Visual Studio Code
Install Visual Studio Installer
Npm update
I faced same issue in past days when trying to npm install using node with too new version of npm (angualar 14, node 14.16/16.13/18.7, npm 8.15). Try to downgrade npm version using
npm install -g npm#version
I used npm#8.5.0 and it worked

Error while updating to Meteor 1.4

Recently, Meteor has been upgraded to v1.4, well that's great! Unfortunately for me, I cannot upgrade it and have an error log like this.
While loading package npm-bcrypt#0.8.7:
error: Command failed:
/root/.meteor/packages/meteor-tool/.1.4.0.1oo55z5++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm
rebuild --no-bin-links --update-binary
sh: 1: node-gyp: Permission denied
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv
"/root/.meteor/packages/meteor-tool/.1.4.0.1oo55z5++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/root/.meteor/packages/meteor-tool/.1.4.0.1oo55z5++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm"
"rebuild" "--no-bin-links" "--update-binary"
npm ERR! node v4.4.7
npm ERR! npm v3.10.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bcrypt#0.8.7 install: `node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the bcrypt#0.8.7 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!
/root/.meteor/packages/npm-bcrypt/.0.8.7.1i1986o++os.linux.x86_64+web.browser+web.cordova/npm/node_modules/.temp-1fwxhnx/npm-debug.log
sh: 1: node-gyp: Permission denied
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv
"/root/.meteor/packages/meteor-tool/.1.4.0.1oo55z5++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/root/.meteor/packages/meteor-tool/.1.4.0.1oo55z5++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm"
"rebuild" "--no-bin-links" "--update-binary"
npm ERR! node v4.4.7
npm ERR! npm v3.10.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bcrypt#0.8.7 install: `node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the bcrypt#0.8.7 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!
/root/.meteor/packages/npm-bcrypt/.0.8.7.1i1986o++os.linux.x86_64+web.browser+web.cordova/npm/node_modules/.temp-1fwxhnx/npm-debug.log
I already tried to uninstall and install node js and npm, I thought it will success but the same error still showed up. Can anyone help me?? thank you
A few different solutions for your issue, depending on platform at:
https://github.com/meteor/meteor/issues/7469#issuecomment-235563857
(Meteor problems are usually easier solved through github issues than Stack Overflow Questions)

YEOMAN INSTALL FAILS

Thanks before starting, Am a kinda of a newbie using yeoman for seeding my new project. I tried to install using, this command
npm install -g yo
i get this error
npm ERR! Error: No compatible version found: yo
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR! at /usr/share/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /root/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /root
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: yo
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/npm-debug.log
my node version is, v0.6.12,
my npm version is, 1.1.4
Help will be mush appreciated.

Node.js: npm doesn't install anymore

I don't know what I did wrong, but trying to install a module using npm returns errors. My concrete example (same results, no matter which module I would like to install):
npm install socket.io
Returns:
npm ERR! TypeError: Cannot call method 'replace' of undefined
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:332:45
npm ERR! at fs.js:117:20
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:53:5
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:62:5
npm ERR! at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "socket.io"
npm ERR! cwd /Users/Hassen/www/node/btask
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! type non_object_property_call
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Hassen/www/node/btask/npm-debug.log
npm ERR! not ok code 0
Any idea? Thanks in advance :)
This error is usually caused by a .git directory in current directory on which no commit has been made.
Either remove the directory or make at least one commit before trying npm again.
EDIT: From this npm issue page;
This issue has been fixed in the latest release. Please update to the latest node and npm (v0.8.17 and v1.2.0, respectively)

Build failing on sqlserver driver for nodejs

I'm trying to install node-sqlserver for my application in the node_modules directory by typing the following command,
npm install node-sqlserver
This is what I get,
npm WARN package.json application-name#0.0.1 No README.md file found!
npm WARN package.json node#0.0.0 No README.md file found!
npm http GET https://registry.npmjs.org/node-sqlserver
npm http 304 https://registry.npmjs.org/node-sqlserver
npm WARN deprecated node-sqlserver#0.1.0: This package has been superseded by msnodesql.
> node-sqlserver#0.1.0 install C:\Users\Tarun\Desktop\Songify\node_modules\node-sqlserver
> node-gyp rebuild
C:\Users\Tarun\Desktop\Songify\node_modules\node-sqlserver>node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node
-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! rebuild error Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! rebuild error at failNoPython (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\con
figure.js:85:14)
gyp ERR! rebuild error at Object.oncomplete (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\li
b\configure.js:59:11)
gyp ERR! not ok
npm ERR! node-sqlserver#0.1.0 install: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the node-sqlserver#0.1.0 install script.
npm ERR! This is most likely a problem with the node-sqlserver package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sqlserver
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\
\npm-cli.js" "install" "node-sqlserver"
npm ERR! cwd C:\Users\Tarun\Desktop\Songify\node_modules
npm ERR! node -v v0.6.20
npm ERR! npm -v 1.1.37
npm ERR! code ELIFECYCLE
npm ERR! message node-sqlserver#0.1.0 install: `node-gyp rebuild`
npm ERR! message `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\Tarun\Desktop\Songify\node_modules\npm-debug.log
npm ERR! not ok code undefined
npm ERR! not ok code 1
How do I resolve this issue? I'm using express as well
Your answer is in the output, you need to install python, following that you will get another error, you will need to install Microsoft SDK for Windows Server 2008 and dot net framework 3.5

Resources