'npm ERR! code ENOTEMPTY while npm install
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.
Solution 1:[1]
I had the same error/issue, and I removed the directory.
rm -r node_modules/MODULE
It simply worked!
Solution 2:[2]
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.
Solution 3:[3]
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.
Solution 4:[4]
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
Solution 5:[5]
Error message say that /nodejsAction/node_modules/setprototypeof
is not empty
You have to remove this directory or rename this directory in my case I removed this particular directory
This error show that to Install or update NPM Package you have to remove the particular directory
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Ganesh Jadhav |
Solution 3 | Sam Rothstein |
Solution 4 | Tofi A. |
Solution 5 | Gulshan Prajapati |