Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm ERR! code ENOTEMPTY while npm install

Tags:

npm

dockerfile

I get the below-mentioned error when trying to do NPM install in my Dockerfile. I do delete node_modules before running NPM install still I end up with this error.

npm ERR! node v6.2.0
npm ERR! npm  v3.8.9
npm ERR! path /nodejsAction/node_modules/setprototypeof
npm ERR! code ENOTEMPTY
npm ERR! errno -39
npm ERR! syscall rmdir

npm ERR! ENOTEMPTY: directory not empty, rmdir 
'/nodejsAction/node_modules/setprototypeof'

Any idea how I can fix this? It seems to work properly on my local mac but on my Jenkins server the script fails.

like image 621
Sandy Avatar asked May 04 '17 09:05

Sandy


4 Answers

I think the following command might be more appropriate:

rm -r node_modules

This will remove the node_modules folder in your repository. The command npm install should work now.

If you are using Webpack, you can also remove the dist folder using rm -r dist and re-build your repository.

like image 117
Sam Rothstein Avatar answered Oct 23 '22 20:10

Sam Rothstein


I had the same issue, i did following:
1. Restart system
2. Close VS, VSCode or any editor that has JS files open.
3. Apparently, you might have to do npm install in other directories too before doing it in target folder.

like image 26
Ganesh Jadhav Avatar answered Oct 23 '22 18:10

Ganesh Jadhav


I had the same error/issue, and I removed the directory.

rm -r node_modules/MODULE

It simply worked!

like image 13
X 47 48 - IR Avatar answered Oct 23 '22 19:10

X 47 48 - IR


In my case, the ENOTEMPTY followed an ERR_SOCKET_TIMEOUT. It also carried an instruction to rename the module (uuid to uuid-<some string>, nanoid to nanoid-<some string>)- renaming led to the same issue, with or without verifying the cache. The fix for this, without having to nuke the cache, was to delete both the source and destination modules

rm -r node_modules/<module>
rm -r node_modules/.<module>-<string suffix>

and then continue the install. Quite similar to an answer given here but deleting just the module wasn't enough for me

like image 4
Tofi A. Avatar answered Oct 23 '22 19:10

Tofi A.