error: This is probably not a problem with npm. There is likely additional logging output above
Solution 1
Finally, I found a solution to this problem without reinstalling npm and I'm posting it because in future it will help someone, Most of the time this error occurs javascript heap went out of the memory. As the error says itself this is not a problem with npm. Only we have to do is
instead of,
npm run build -prod
extend the javascript memory by following,
node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build --prod
Solution 2
Delete your package-lock.json
file and node_modules
folder.
Then do npm cache clean
npm cache clean --force
do
npm install
again and run
Solution 3
I'm on Ubuntu 18.04. I fixed this problem by increasing the inotify max_user_watches using this command:
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
Solution 4
I'm new with react... Well i had the same output:
Starting the development server...
events.js:196
throw er; // Unhandled 'error' event
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/opt/lampp/htdocs/react-tuto/public'
at FSWatcher.<computed> (internal/fs/watchers.js:168:26)
at Object.watch (fs.js:1351:34)
at createFsWatchInstance (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher.<anonymous> (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher.<anonymous> (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqCallback.oncomplete (fs.js:165:5)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:40:5)
at setFsWatchListener (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[... lines matching original stack trace ...]
at FSReqCallback.oncomplete (fs.js:165:5) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/opt/lampp/htdocs/react-tuto/public',
filename: '/opt/lampp/htdocs/react-tuto/public'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! /home/paulo/.npm/_logs/2019-12-16T16_46_27_856Z-debug.log
I just tried:
sudo npm start
And it worked.
Solution 5
Please delete package-lock.json
and clear npm cache with npm cache clear --force
and delete whole node_modules
directory
Finally install or update packages again with npm install
/ npm update
You can also add any new packages with npm install <package-name>
This fixed for me.
Thanks and happy coding.
INDRAJITH EKANAYAKE
MSc(Reading),BSc(Plymouth)-1st, MIEEE, MCIM Engineer | Writer | Public Speaker To read my blog click here To message me on my Twitter handle click here To follow me on LinkedIn click here
Updated on July 09, 2022Comments
-
INDRAJITH EKANAYAKE almost 2 years
In my project, I'm using Angular6 for the frontend. Now what I'm trying to do is deploy my project which is in remote server into the actual server. I'm using
npm run build -prod
command to build the frontend first. But I can't build my project since the following error occurs again and again,npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! [email protected] build: `ng build --prod --build-optimizer --aot` npm ERR! Exit status 134 npm ERR! npm ERR! Failed at the [email protected] build 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\Indrajith.E\AppData\Roaming\npm-cache\_logs\2019-08-22T08_41_00_271Z-debug.log
My error log in the
C:\Users\Indrajith.E\AppData\Roaming\npm-cache\_logs\2019-08-22T08_41_00_271Z-debug.log
file path contains the same error details mentioned above.How can I resolve this problem?
-
INDRAJITH EKANAYAKE over 4 yearsPlease can you update the answer I dont want to reinstall npm because I'm working with very large project
-
x89 over 4 yearsDo we just type this on the terminal? Didn't work for me.
-
INDRAJITH EKANAYAKE about 4 yearsBut reinstalling the whole npm package is not the best practice
-
smartmouse about 4 yearsDid you mean 4096?
-
alramdein almost 4 yearsCan you do this kind of thing but in React project ?
-
INDRAJITH EKANAYAKE almost 4 yearsI personally not too familiar with react but I hope so
-
Ak777 almost 4 yearsThis is the fix for me to get to work on my local machine. I also had the same error on my Azure DevOps pipeline. we were using "npm run build -- --configuration=prod --base-href=/path/". It worked for all other config params except this prod. So i ended up updating to simply "npm run build -- --prod --base-href=/path/". I hope it may be helpful to someone.
-
Anant Dhas over 2 yearsthanks. your answer helped me a lot.
-
Sarthak Raval over 2 yearsremoving node modules does not harm our dependencies or further project?
-
Aslam Shaik over 2 years@SarthakRaval, as you are installing them again in the next steps there will be no harm in it.
-
sachin sakhare about 2 yearsThank you this worked for me. This can be solution of above error