When I run 'npm install' to install the dependencies from a cloned repository I get the error below from the terminal. I use windows 10
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-scripts#4.0.0
npm ERR! Found: typescript#4.1.3
npm ERR! node_modules/typescript
npm ERR! dev typescript#"4.1.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript#"^3.2.1" 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! Conflicting peer dependency: typescript#3.9.10
npm ERR! node_modules/typescript
npm ERR! peerOptional typescript#"^3.2.1" 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 ERR!
npm ERR! See C:\Users\USER-PC\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\USER-PC\AppData\Local\npm-cache\_logs\2022-10-04T10_18_32_
Even when I ran npm install --legacy-peer-deps I still get same error. Please what could possibly be wrong?
And here's the content in my package.json file:
}
]
"name": "info-site",
"version": "1.0.0",
"description": "",
"keywords": [],
"main": "src/index.js",
"dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0",
"react-scripts": "4.0.0"
},
"devDependencies": {
"#babel/runtime": "7.13.8",
"typescript": "4.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
The error is telling you that react-scripts#4.0.0 supports typescript#^3.2.1 (i.e. TypeScript >=3.2.1, <4) as a peer dependency.
Your dev dependencies have TypeScript 4 (not 3.2.x) in them, which is not supported by that version of react-scripts, hence the resolution error.
The current version of react-scripts is 5.0.1, so I'd recommend upgrading react-scripts to that version (simply by changing that "4.0.0" in your package.json to "5.0.1") and trying again, since that version declares support for TypeScript 4.
Can anyone tell me what's incorrect here? I am trying to install the mui search bar component.
npm i --save material-ui-search-bar
However I do receive the following:
PS Z:\WebDev\ApplyWithin\frontend> npm i --save material-ui-search-bar
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: new#0.1.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"^17.0.2" from the root project
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.3
npm ERR! node_modules/#material-ui/core
npm ERR! peer #material-ui/core#"^4.0.0" from material-ui-search-bar#1.0.0
npm ERR! node_modules/material-ui-search-bar
npm ERR! material-ui-search-bar#"*" 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#"^4.11.2" from the root project
npm ERR! 1 more (material-ui-search-bar)
npm ERR! 2 more (react-dom, #material-ui/icons)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0" from material-ui-search-bar#1.0.0
npm ERR! node_modules/material-ui-search-bar
npm ERR! material-ui-search-bar#"*" 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.
My package.json is:
{
"name": "new",
"version": "0.1.0",
"private": true,
"dependencies": {
"#emotion/react": "^11.7.0",
"#emotion/styled": "^11.6.0",
"#fontsource/roboto": "^4.5.1",
"#material-ui/icons": "^4.11.2",
"#mui/icons-material": "^5.2.4",
"#mui/material": "^5.2.3",
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"framer-motion": "^4.1.17",
"gsap": "^3.9.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-intersection-observer": "^8.33.1",
"react-scripts": "4.0.3",
"react-typewriter-effect": "^1.1.0",
"styled-components": "^5.3.3",
"typewriter-effect": "^2.18.2",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Does anyone have a clue here?
Issue seems to be related to peer dependency of material-ui-search-bar. Having a peer dependency means that your package needs a dependency that is the same exact dependency as the person installing your package.
As stated in the error posted by you. It needs react version ^16.8.0 or lower to run.
But in your project you have specified an bigger version of react - ^17.0.2.
What you can do is lower your react version. Then you should be able to install the said package without any issues.
I've been using node.js/npm to deploy my React website to GitHub Pages but an error keeps showing up and not sure how to approach it. I have been looking around for solutions but there doesn't seem to be anything for this particular scenario:
I run the npm run build command for the completed application and add the correct GitHub Pages scripts in my package.json file below -
{
"name": "portfolio",
"version": "0.1.0",
"homepage": "https://darstnfrd.github.io/portfolio",
"private": true,
"dependencies": {
"bootstrap": "^4.0.0",
"gulp-sass": "^3.1.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.1"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"gh-pages": "^1.1.0"
}
}
Afterwards, I run npm install --save-dev gh-pages. From here, when I run npm run deploy this error below keeps emerging -
> portfolio#0.1.0 deploy C:\Users\darren\Desktop\react2018\portfolio
> gh-pages -d build
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:686:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio#0.1.0 deploy 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\darren\AppData\Roaming\npm-cache\_logs\2018-03-12T02_09_20_837Z-debug.log
My GitHub Pages repository is ready to go. Additional actions I've tried are npm rm -rf node_modules, npm cache clean and reinstalling bootstrap dependency.
What exactly is the error? If any more information is needed, please let me know. Thank you very much!
Hope all is well. I'm setting up protractor for the first time through Node.js. This is provided as part of a tutorial on the AngularJS website under "Running E2E Tests":
https://docs.angularjs.org/tutorial
However, while executing protractor through the provided command "npm run protractor", I get the following error within the Node.js command prompt:
E/launcher - Process exited with error code 199
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 protractor: `protractor e2e-tests/protractor.conf.js`
npm ERR! Exit status 199
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 protractor script 'protractor e2e-tests/protractor.conf.js'.
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 angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor e2e-tests/protractor.conf.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-phonecat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
Here is the contents on the package.json file:
{
"name": "angular-phonecat",
"private": true,
"version": "0.0.0",
"description": "A tutorial application for AngularJS",
"repository": "https://github.com/angular/angular-phonecat",
"license": "MIT",
"devDependencies": {
"bower": "^1.7.7",
"http-server": "^0.9.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.8",
"protractor": "^4.0.9"
},
"scripts": {
"postinstall": "bower install",
"prestart": "npm install",
"start": "http-server ./app -a localhost -p 8000 -c-1",
"pretest": "npm install",
"test": "karma start karma.conf.js",
"test-single-run": "karma start karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor e2e-tests/protractor.conf.js",
"update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/##NG_LOADER_START##[\\s\\S]*\\/\\/##NG_LOADER_END##/).join('//##NG_LOADER_START##\\n'+loaderText+' //##NG_LOADER_END##');fs.writeFileSync(indexFile,indexText);\""
}
}
I don't know if anyone else has tried this same tutorial and is getting the same issue? Any help would be most appreciated, thank you.
So Protractor can be started in several ways, the most common are by directConnect or by seleniumAddress. Since no value was set in the e2e-tests/protractor.config.js file, the assumed value is directConnect. To get directConnect to work with the chrome browser, you'll need to get the latest chromedriver. To just install chromedriver:
./node_modules/.bin/webdriver-manager update --standalone=false --gecko=false
Or as suggested in the github angular-seed page which will download, in addition, the selenium standalone jar file and gecko driver (which is used for firefox):
npm update-webdriver
I have a project who I didn't touch for 2 weeks. I take it back and now when I try to run npm start I got this error.
> react-scripts start
sh: react-scripts: command not found
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.7.0
npm ERR! npm v3.10.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! UpScore#0.6.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the UpScore#0.6.0 start script 'react-scripts start'.
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 UpScore package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs UpScore
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls UpScore
npm ERR! There is likely additional logging output above.
node 6.7.0
npm 3.10.3
mac sierra 10.12
package.json
{
"name": "UpScore",
"version": "0.6.0",
"private": true,
"devDependencies": {
"react-addons-test-utils": "^15.3.1",
"react-scripts": "0.4.1",
"react-test-renderer": "^15.3.1",
"redux-logger": "^2.6.1"
},
"dependencies": {
"#yoshokatana/medium-button": "^1.1.0",
"axios": "^0.14.0",
"bcrypt": "^0.8.7",
"bcrypt-nodejs": "0.0.3",
"bcryptjs": "^2.3.0",
"body-parser": "^1.15.2",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.4.3",
"draft-js": "^0.8.1",
"draft-js-editor": "^1.7.2",
"draft-js-export-html": "^0.4.0",
"ejs": "^2.5.2",
"email-verification": "^0.4.5",
"express": "^4.14.0",
"express-session": "^1.14.1",
"flexboxgrid": "^6.3.1",
"highlight.js": "^9.6.0",
"immutable": "^3.8.1",
"katex": "^0.6.0",
"lodash": "^4.15.0",
"markdown-it-mathjax": "^1.0.3",
"material-ui": "^0.15.4",
"medium-editor": "^5.22.0",
"minutes-seconds-milliseconds": "^1.0.3",
"moment": "^2.15.0",
"moment-duration-format": "^1.3.0",
"mongod": "^1.3.0",
"mongodb": "^2.2.9",
"mongoose": "^4.6.0",
"monk": "^3.1.2",
"morgan": "^1.7.0",
"normalize.css": "^3.0.3",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"react": "^15.3.1",
"react-dom": "^15.3.1",
"react-markdown": "^2.4.2",
"react-medium-editor": "^1.8.1",
"react-redux": "^4.4.5",
"react-redux-form": "^0.14.5",
"react-rich-markdown": "^1.0.1",
"react-router": "^2.7.0",
"react-router-redux": "^4.0.5",
"react-tap-event-plugin": "^1.0.0",
"react-tinymce": "^0.5.1",
"redux": "^3.6.0",
"redux-form": "^6.0.5",
"redux-form-material-ui": "^4.0.1",
"redux-promise-middleware": "^4.0.0",
"redux-thunk": "^2.1.0",
"reselect": "^2.5.3",
"screenfull": "^3.0.2"
},
"scripts": {
"start": "react-scripts start",
"start:prod": "pushstate-server build",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"server": "cd client/api && pm2 start server.js --watch",
"proxy": "http://128.199.139.144:3000"
},
"eslintConfig": {
"extends": "./node_modules/react-scripts/config/eslint.js"
}
}
I try to clone my repos too and get the same error. If someone can give me some way to find what happen. Thank you
Author of Create React App checking in.
You absolutely should not be installing react-scripts globally.
You also don't need ./node_modules/react-scripts/bin/ in package.json as this answer implies.
If you see this:
npm ERR! UpScore#0.6.0 start: `react-scripts start`
npm ERR! spawn ENOENT
It just means something went wrong when dependencies were installed the first time.
I suggest doing these three steps:
npm install -g npm#latest to update npm because it is sometimes buggy.
rm -rf node_modules to remove the existing modules.
npm install to re-install the project dependencies.
This should fix the problem.
If it doesn't, please file an issue with a link to your project and versions of Node and npm.
It seems like you don't have react-scripts in your global environment.
Two possibility are available here :
npm install -g react-scripts
or in your package.json change your script part like this :
"scripts": {
"start": "./node_modules/react-scripts/bin/react-scripts.js start",
"start:prod": "pushstate-server build",
"build": "./node_modules/react-scripts/bin/react-scripts.js build",
"test": "./node_modules/react-scripts/bin/react-scripts.js test --env=jsdom",
"eject": "./node_modules/react-scripts/bin/react-scripts.js eject",
"server": "cd client/api && pm2 start server.js --watch",
"proxy": "http://128.199.139.144:3000"
},
Yes you should not install react-scripts globally, it will not work.
I think i didn't use the --save when i first created the project (on another machine), so for me this fixed the problem :
npm install --save react react-dom react-scripts
incase you happened to be so unlucky like me that spent three(3) days in a row trying to solve this problem every solution proposed here failed me ... create a .env file in your project root and add this code SKIP_PREFLIGHT_CHECK=true. Good luck
This is to help others completely new to react and who area having problems just starting a first app even though they did a fresh install and try using npm install and the other fixes I saw around the forums.
Running it on Windows 10 with all the latest npm create-react-app installed and got failure after failure on a simple npm start in a simple my-app demo folder.
Spent a long time with what looks similar to the OP error at first but is slightly different. This starts with ERRNO 4058 and continues with code 'ENOENT' syscall: 'spawn cmd', path: ''cmd' ...
Eventually worked out from github create-react-app forum that a quick fix for this is registering cmd in the "path" variable. To do this go to System Properties>Environment variables. Click on path variable edit and and add new entry of C:\Windows\System32. Restart CMD prompt and I was good to go.
As Dan said correctly,
If you see this:
npm ERR! UpScore#0.6.0 start: `react-scripts start`
npm ERR! spawn ENOENT
It just means something went wrong when dependencies were installed the first time.
But I got something slightly different because running npm install -g npm#latest to update npm might sometimes leave you with this error:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for npm#lates
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
so, instead of running npm install -g npm#latest, I suggest running the below steps:
npm i -g npm //which will also update npm
rm -rf node_modules/ && npm cache clean // to remove the existing modules and clean the cache.
npm install //to re-install the project dependencies.
This should get you back on your feet.
I might be very late to answer this question but this is what has worked for me and it might help someone to get back on the development track!
nvm install v12.0 // You may need to install nvm, if not already done
rm -rd node_modules/
npm cache clean --force
npm install
Cheers!!
For me it was simply that I hadn't added react-scripts to the project so:
npm i -S react-scripts
If this doesn't work, then rm node_modules as suggested by others
rm -r node_modules
npm i
I have faced the following issue.
Please find the solution:
Add "C:\Windows\System32" to the global PATH environment variable.
Check whether the environment variables has been created for nodejs,npm and composer. if not create one
Run your app.
I had the same error when running
npm start
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protest-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protest-app#0.1.0 start script.
I broke my head on several tabs and applying Solutions from other devs and nothing.
Until, even using Ubuntu, I closed my vscode and restarted my pc and all my problems were solved. (kkkk zueira) just this one.
add environment variables in windows
C:\WINDOWS\System32
C:\Program Files\nodejs
C:\Program Files\nodejs\node_modules\npm\bin
C:\WINDOWS\System32\WindowsPowerShell\v1.0
C:\Users{your system name without curly
braces}\AppData\Roaming\npm
these 5 are must in path.
and use the latest version of node.js
I solve this issue by running following command
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
hope it helps
Add .env file with "SKIP_PREFLIGHT_CHECK=true" than npm start
I fix this using this following command:
npm install -g react-scripts
it is simple but the first time it takes time a few steps to set !!!
you have the latest version on node.
go to the environment variable and set the path "%SystemRoot%\system32".
run cmd as administrator mode.
write command npm start.
i ran npm install inside the project
then npm start
it worked
just delete the "node_module" file and if its seems somehow grey in folder that means it's not there just close the vs code and re open then
install npm with "npm install".
it's possible that conflict with other library, delete node_modules and again npm install.
This occurs when the node_modules gets out of sync with package.json.
Run the following at the root and any sub service /sub-folder that might have node_modules folder within it.
rd node_modules /S /Q
npm install
It occurred to me but none of the above worked.
events.js:72
throw er; // Unhandled 'error' event
^
npm ERR! UpScore#0.6.0 start: `react-scripts start`
npm ERR! spawn ENOENT
Error: spawn ENOENT
at errnoException (child_process.js:1000:11)
at Process.ChildProcess._handle.onexit (child_process.js:791:34)
This happens because you might have installed react-scripts globally.
To make this work...
Go to your C:\Users\<USER>\AppData\Roaming
Delete npm and npm-cache directories... (don't worry you can install npm globally later)
Go back to your application directory and remove node_modules folder
Now enter npm install to install the dependencies (delete package-lock.json if its already created)
Now run npm install --save react react-dom react-scripts
Get it started with npm start
This should get you back on track... Happy Coding
My issue was stemming from permission issues. I solved mine by following this
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
Type unset HOST in your terminal.
I have created react project locally. This reason of occurring this problem (for me) was that I didn't use sudo before npm and it needs root access (
> sudo npm start
PS1: For windows users, the powershell or command line should be run as administrator)
PS2: If use want to solve the root access issue, you can see this post.
for me I create a .env file in the project root and after that I write one line SKIP_PREFLIGHT_CHECK=true. It work for me