Have you ever been to this error? I came across this once. When I was trying to run react app localhost it gave me this.

throw er; // Unhandled 'error' event

some errors are tricky that need some more research and logic. It was one of them. I resolved this issue but it took 2 days.

Execute the below command to kill all current processes and see if it will work or not.

sudo killall -9 node

Try to install the below npm package. It has resolved my issue.

npm install ws@3.3.2 --save-dev --save-exact

If it doesn’t help then it may be a cache problem. You can remove it by the below command.

npm cache clean --force or sudo npm cache clean --force

See it works or not. if not try to give permission to your all files. It might be a permission problem sometimes that restricts installation packages.

sudo chown -R 1000:1000 "/home/prem/.npm"

Now try to remove node_modules and install packages with npm i. If it will work better then try to avoid ENOSPC by below command:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 

Above code with increase user_watches and avoid ENOSPC.

Thanks for reading