I'm trying to install a Webpack and Babel to use React without CRA.
During installation webpack-dev-server, I've facing with some dependencies problems
PS C:\Users\Lebedev\Desktop\projects\frontend-graduation-project> npm install --save-dev webpack-dev-server
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: webpack#5.4.0
npm ERR! node_modules/webpack
npm ERR! peer webpack#">=2" from babel-loader#8.2.1
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader#"^8.2.1" from the root project
npm ERR! peer webpack#"^4.27.0 || ^5.0.0" from css-loader#5.0.1
npm ERR! node_modules/css-loader
npm ERR! dev css-loader#"^5.0.1" from the root project
npm ERR! 6 more (html-webpack-plugin, style-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"^4.0.0" from webpack-dev-middleware#3.7.2
npm ERR! node_modules/webpack-dev-server/node_modules/webpack-dev-middleware
npm ERR! webpack-dev-middleware#"^3.7.2" from webpack-dev-server#3.11.0
npm ERR! node_modules/webpack-dev-server
npm ERR! dev webpack-dev-server#"*" 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 C:\Users\Lebedev\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\Lebedev\AppData\Local\npm-cache\_logs\2020-11-15T12_42_34_324Z-debug.log
PS C:\Users\Lebedev\Desktop\projects\frontend-graduation-project>
My package.json file:
"dependencies": {
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"devDependencies": {
"#babel/core": "^7.12.3",
"#babel/preset-env": "^7.12.1",
"#babel/preset-react": "^7.12.5",
"babel-loader": "^8.2.1",
"css-loader": "^5.0.1",
"html-webpack-plugin": "^4.5.0",
"style-loader": "^2.0.0",
"webpack": "^5.4.0",
"webpack-cli": "^4.2.0"
}
What I already did and it still not help:
Tried remove node_modules folder
Tried remove package-lock.json file
Reinstall npm dependencies by running this command: npm install
How to solve this problems?
Thanks for any advice
I found the answer on a Github Issue page: https://github.com/npm/cli/issues/2119
My npm version has been 7.0.8. As a mvyunko mention in issue, I just type the following:
npm install npm#latest -g
npm install webpack-dev-server --save-dev
After all commands, my npm version has been changed to 6.14.8, and installation error has gone.
Related
hello everyone today i had a problem that's when i install laravel ui with react and pass to the step of npm install an error occured so below you will find the error
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\E495\AppData\Local\npm-cache\_logs\2023-01-16T08_08_36_872Z-debug-0.log
PS C:\Users\E495\Desktop\laravel-simple-crud> npm install
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: vite#4.0.4
npm ERR! node_modules/vite
npm ERR! dev vite#"^4.0.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vite#"^3.0.0" from #vitejs/plugin-react#2.2.0
npm ERR! node_modules/#vitejs/plugin-react
npm ERR! dev #vitejs/plugin-react#"^2.2.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 ERR!
npm ERR! See C:\Users\E495\AppData\Local\npm-cache\eresolve-report.txt for a full report.
so above the error and below you'll find my package.json
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"#popperjs/core": "^2.11.6",
"#tailwindcss/forms": "^0.5.2",
"#vitejs/plugin-react": "^2.2.0",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.4.2",
"axios": "^1.1.2",
"bootstrap": "^5.2.3",
"laravel-vite-plugin": "^0.7.2",
"lodash": "^4.17.19",
"postcss": "^8.4.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.56.1",
"tailwindcss": "^3.1.0",
"vite": "^4.0.4"
}
}
i try to read the error and change the vite version to 4.0.4 but without any result
You should be able to get by this error with the following command:
npm install --legacy-peer-deps
This previous post goes into detail about what --legacy-peer-deps is doing here.
In short, #vitejs/plugin-react (specifically the version 2.2.0 you have as a dev dependency) has listed an older version of vite (vite#"^3.0.0") as one of its peer dependencies, but it is finding the newer vite#"^4.0.4" installed. For reasons that I can't totally explain (see the linked post or Google if you're curious), NPM is not able to resolve this peer dependency conflict as it usually would for the regular dependencies and dev dependencies that we're more familiar with. --legacy-peer-deps gets around this by bypassing peer dependency auto-installation.
I'm trying to add npm install react-material-ui-carousel --save to my react project. However when I try to install I get this dependency tree issue.
I have alredy deleted the lock and npm modules files, followed by npm install the whole project. Still getting this same error below however.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: buckets#0.1.0
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"^17.0.1" from the root project
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.11.3
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"^4.11.2" from the root project
npm ERR! peer #material-ui/core#"^4.9.11" from react-material-ui-carousel#2.2.1
npm ERR! node_modules/react-material-ui-carousel
npm ERR! react-material-ui-carousel#"*" from the root project
npm ERR! 1 more (#material-ui/icons)
npm ERR! 2 more (react-dom, #material-ui/icons)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.13.1" from react-material-ui-carousel#2.2.1
npm ERR! node_modules/react-material-ui-carousel
npm ERR! react-material-ui-carousel#"*" 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 /home/user/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2021-03-02T19_57_57_671Z-debug.log
My other dependencies:
{
"name": "app",
"version": "0.1.0",
"private": true,
"dependencies": {
"#material-ui/core": "^4.11.2",
"#material-ui/icons": "^4.11.2",
"#material-ui/lab": "^4.0.0-alpha.57",
"#reduxjs/toolkit": "^1.5.0",
"#testing-library/jest-dom": "^5.11.6",
"#testing-library/react": "^11.2.2",
"#testing-library/user-event": "^12.6.0",
"axios": "^0.21.1",
"chartist": "^0.10.1",
"react": "^17.0.1",
"react-chartist": "^0.14.4",
"react-dom": "^17.0.1",
"react-hook-form": "^6.14.2",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"react-window": "^1.8.6",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"web-vitals": "^0.2.4"
},
The other option I could try is --legacy-peer-deps, but I would only do that as a last result option if nothing else works.
How can I properly fix the dependency tree error to get react-material-ui-carousel to install in my project?
Add --force or --legacy-peer-deps at the end of your command.
Like such: npm install react-material-ui-carousel --save --legacy-peer-deps
"peerDependencies":{ "react": "^17.0.1"} add this in your package.json
"#popperjs/core": "^2.6.0",
"#testing-/jest-dom": "^5.11.9",
"#testing-/react": "^11.2.3",
"#testing-/user-event": "^12.6.2",
"bootstrap": "^4.6.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"react-transition-group": "^4.4.1",
versions of dependencies I have in package.json file.
G:\Projects\React\confusion> npm install --save reactstrap
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react#17.0.1
npm WARN node_modules/react
npm WARN peer react#"" from #testing-/react#11.2.3
npm WARN node_modules/#testing-/react
npm WARN #testing-/react#"^11.2.3" from the root project
npm WARN 3 more (react-dom, the root project, reactstrap)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"0.14.x || ^15.0.0 || ^16.0.0" from react-popper#1.3.7
npm WARN node_modules/react-popper
npm WARN react-popper#"^1.3.6" from reactstrap#8.9.0
npm WARN node_modules/reactstrap
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! peer react#"" from #testing-/react#11.2.3
npm ERR! node_modules/#testing-/react
npm ERR! #testing-/react#"^11.2.3" from the root project
npm ERR! peer react#"17.0.1" from react-dom#17.0.1
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"" from #testing-/react#11.2.3
npm ERR! node_modules/#testing-/react
npm ERR! #testing-/react#"^11.2.3" from the root project
npm ERR! react-dom#"^17.0.1" from the root project
npm ERR! 1 more (reactstrap)
npm ERR! 2 more (the root project, reactstrap)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^0.14.0 || ^15.0.0 || ^16.0.0" from create-react-context#0.3.0
npm ERR! node_modules/react-popper/node_modules/create-react-context
npm ERR! create-react-context#"^0.3.0" from react-popper#1.3.7
npm ERR! node_modules/react-popper
npm ERR! node_modules/reactstrap
npm ERR! reactstrap#"" 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.
This is because of a change in npm version 7. See the breaking changes section here. You can fix it by using the flag the error tells you to use at the bottom: npm i reactstrap --legacy-peer-deps. If one of your other dependencies already has reactstrap as a peer dependency, you might not need to install it at all (you can check with npm ls reactstrap), due to the change in v7.
Try something like this in your package.json
"engines": {
"npm": ">=8.7.0"
},
"overrides": {
"react": "$react"
}
This will force react to be the version defined in your "dependencies" for all dependencies (& deps of deps).
You need "recent" npm as it was buggy in some version (I had 8.3.0 and overrides wasn't working). 8.7.0 seems ok !
See https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
Delete node modules,
then npm i reactstrap --legacy-peer-deps
then npm install --force
solved it for me
To resolve REACT_SPRING installation issue try
npm install --force
then
npm audit fix --force
I was using Nodemon.js. For production i decided to delete nodemon and set script "start" to "node index.js" but now i am encountering this error. ( I have completely uninstalled nodemon from my system, deleted from dependencies, re-installed node.)
Already tried Npm cache clean --force,
Uninstalled Node multiple times
> hpgrmnode#1.0.0 start E:\Abhi\hpgrmnode
> node index.js
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js
npm ERR! file E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js
npm ERR! path E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js
npm ERR! errno ENOENT
npm ERR! hpgrmnode#1.0.0 start: `node index.js`
npm ERR! spawn E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js ENOENT
npm ERR!
npm ERR! Failed at the hpgrmnode#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mukesh\AppData\Roaming\npm-cache\_logs\2020-06-02T16_31_24_429Z-debug.log
This is log file
https://pastebin.com/EAiKbBii
Note
I have recently changed my folder name from hpgrm_node to hpgrmnode but still the path is showing for hpgrm_node
*** npm ERR! file E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js
npm ERR! path E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js
Dependencies
{
"name": "hpgrmnode",
"version": "1.0.0",
"description": "HPGRM web application",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "Abhishek",
"license": "ISC",
"dependencies": {
"alert": "^5.0.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"connect-flash": "^0.1.1",
"connect-mongo": "^3.2.0",
"dotenv": "^8.2.0",
"edge.js": "^1.1.4",
"express": "^4.17.1",
"express-edge": "^2.0.2",
"express-fileupload": "^1.1.7-alpha.3",
"express-session": "^1.17.1",
"helmet": "^3.22.0",
"mongoose": "^5.9.16"
},
"engines": {
"node": "12.16.1"
}
}
With simple command "> node index.js"
Getting this warning
E:\Abhi\hpgrmnode>node index.js
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
And if i am trying to install nodemon
getting this error
E:\Abhi\hpgrmnode>npm install nodemon --save-dev
> nodemon#2.0.4 postinstall E:\Abhi\hpgrmnode\node_modules\nodemon
> node bin/postinstall || exit 0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
npm WARN hpgrmnode#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js
npm ERR! file E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js
npm ERR! path E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js
npm ERR! errno ENOENT
npm ERR! nodemon#2.0.4 postinstall: `node bin/postinstall || exit 0`
npm ERR! spawn E:\Abhi\hpgrm_Node\node_modules\nodemon\bin\nodemon.js ENOENT
npm ERR!
npm ERR! Failed at the nodemon#2.0.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mukesh\AppData\Roaming\npm-cache\_logs\2020-06-02T16_49_22_968Z-debug.log
I want to install packages with npm:
my packages file is:
"dependencies": {
"express": "~3.3.6",
"socket.io": "0.9.16",
"jade": "~0.35.0",
"less-middleware": "~0.1.12",
"redis": "~0.8.4",
"connect-redis": "~1.4.5",
"longjohn": "~0.2.1",
"mongoose": "~3.6.20",
"json-stringify-safe": "~5.0.0"
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.2",
"grunt-nodemon": "~0.1.0",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-less": "~0.7.0",
"grunt-ngmin": "0.0.3"
}
}
but i have this error :
npm http 304 https://registry.npmjs.org/underscore.string
npm ERR! Error: No compatible version found: underscore.string#'~2.2.0rc'
npm ERR! Valid install targets:
npm ERR! ["0.9.2","1.0.0","1.1.3","1.1.4","1.1.5","1.1.6","2.0.0","2.1.0","2.1.1","2.3.0","2.3.1","2.3.2","2.2.1","2.2.0-rc","2.3.3"]
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:685:10)
npm ERR! at /usr/share/npm/lib/cache.js:607:10
npm ERR! at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:138:7)
npm ERR! at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/vahid/Workspace/talkie/npm-debug.log npm
npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/vahid/Workspace/talkie
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
how i can fix this error? thanks!
If you have a Grunt version that has not yet applied this patch, then you will get that error due to a mistype where this line in the package.json:
underscore.string#'~2.2.0rc
Should instead be this:
underscore.string#'~2.2.0-rc
To fix this problem, use a newer version of Grunt.
in package.json change sails ">0.9"
and grunt ">0.4.1"
thats all