error: This is probably not a problem with npm. There is likely additional logging output above
Asked Answered
P

22

51

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?

Paolo answered 22/8, 2019 at 8:47 Comment(0)
P
30

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
Paolo answered 22/8, 2019 at 9:19 Comment(4)
Do we just type this on the terminal? Didn't work for me.Dehydrate
Did you mean 4096?Scholz
Can you do this kind of thing but in React project ?Therron
I personally not too familiar with react but I hope soPaolo
S
78

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

Sleazy answered 22/8, 2019 at 8:56 Comment(1)
Please can you update the answer I dont want to reinstall npm because I'm working with very large projectPaolo
P
30

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
Paolo answered 22/8, 2019 at 9:19 Comment(4)
Do we just type this on the terminal? Didn't work for me.Dehydrate
Did you mean 4096?Scholz
Can you do this kind of thing but in React project ?Therron
I personally not too familiar with react but I hope soPaolo
P
10

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.

Plebs answered 5/7, 2020 at 18:19 Comment(2)
thanks. your answer helped me a lot.Shipmate
Thank you this worked for me. This can be solution of above errorKeynote
L
9

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

Limbert answered 14/1, 2020 at 15:33 Comment(0)
J
6

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.

Joke answered 16/12, 2019 at 16:47 Comment(0)
G
5

I already have the same problem . and I fix it using npm update & npm cache clean --force

Gumbo answered 12/4, 2020 at 22:42 Comment(1)
This 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.Motif
L
4

Delete node_modules

rm -r node_modules

install packages again

npm install
Lamkin answered 7/9, 2020 at 7:55 Comment(2)
removing node modules does not harm our dependencies or further project?Plover
@SarthakRaval, as you are installing them again in the next steps there will be no harm in it.Lamkin
F
4

Delete node_module directory and run below in command line

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

If still not working, try below

npm install webpack --save
Following answered 19/2, 2021 at 15:26 Comment(0)
T
4

For the people it didn't work, I spent two days finding the solution and there was just one command that worked like a magic.

npm install -g live-server

and then run: npm start

it will start as normal.You can read all the details here https://www.npmjs.com/package/live-server

Tankoos answered 1/7, 2021 at 11:41 Comment(0)
K
3

For me, the problem was in firebase.json, the site name was incorrect.

Keble answered 21/11, 2020 at 4:6 Comment(0)
D
3

I had encountered the same error. And, I just simply deleted the whole node_modules folder, and installed the npm packages again solved my error.

  1. Delete node_modules (don't worry you have package.json)

  2. npm install

Devastation answered 26/5, 2022 at 4:5 Comment(0)
C
2

Deleting the package-lock.json did it for me. I'd suggest you not push package-lock.json to your repo as I wasted hours trying to npm install with the package-lock.json in the folder which gave me helluva errors.

Converge answered 25/11, 2019 at 5:42 Comment(1)
But reinstalling the whole npm package is not the best practicePaolo
R
2

Check if port you want to run your app is free. For me, it was the problem.

Rectus answered 26/12, 2019 at 13:15 Comment(0)
Z
2

Following steps solves my problem: Add "C:\Windows\System32\" to your system path variables Run npm eject, Run npm start, Run npm eject, and agian run npm start And it worked😊

Ziegfeld answered 19/3, 2020 at 11:47 Comment(0)
S
2

For me, I was trying to install an old version of bcrypt which was not found in npm, I just edited package.json and manually put the latest version and then ran npm install and it worked

Swane answered 12/5, 2020 at 23:46 Comment(0)
C
2
  1. first delete the file (project).
  2. then rm -rf \Users\Indrajith.E\AppData\Roaming\npm-cache_logs\2019-08-22T08_41_00_271Z-debug.log (this is the file(log) which is showing error).
  3. recreate your project for example :- npx create-react-app hello_world
  4. then cd hello_world.
  5. then npm start.

I was also having this same error but hopefully after spending 1 day on this error i have got this solution and it got started perfectly and i also hope this works for you guys also...

Chassepot answered 31/8, 2020 at 14:55 Comment(0)
V
1

Novice mistake. Make sure your package.json file is coded correctly. I had:

"start": "index node.js"
instead of:
"start": "node index.js"

17

Delete your package-lock.json file and node_modules folder. Then do npm cache clean

npm cache clean --force do npm install

Vicissitude answered 5/6, 2020 at 1:56 Comment(0)
T
1

I just do two steps: first:

export METEOR_ALLOW_SUPERUSER=true;

second:

sudo systemctl stop bbb-html5

and finally:

npm start
Tritium answered 15/4, 2021 at 4:19 Comment(0)
P
1

My project is on wagtail. I solved this problem by running the following command:npm update & npm cache clean --force

Pasia answered 5/9, 2021 at 0:40 Comment(0)
C
1

I had the issue in React. In my case it was happening, because I didn't see warnings/errors above the message. After fixing the issues, everything worked properly. Hopefully it's going to help someone.

Chlamydate answered 10/12, 2021 at 21:5 Comment(0)
A
1

On Ubuntu, I restarted the server and the problem was solved.

Aposematic answered 7/1, 2022 at 18:49 Comment(0)
H
1

For me, it happens because of the low version of Node. Upload my Node version and it worked successfully.

Hammon answered 13/6, 2022 at 15:39 Comment(1)
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From ReviewMarocain

© 2022 - 2024 — McMap. All rights reserved.