[英]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.尝试在我的 Dockerfile 中执行 NPM 安装时出现以下错误。我确实在运行 NPM 安装之前删除了 node_modules,但我最终还是遇到了这个错误。
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.它似乎在我的本地 mac 上正常工作,但在我的 Jenkins 服务器上脚本失败。
I had the same error/issue, and I removed the directory.我有同样的错误/问题,我删除了目录。
rm -r node_modules/MODULE
It simply worked!它很简单!
I think the following command might be more appropriate:我认为以下命令可能更合适:
rm -r node_modules
This will remove the node_modules
folder in your repository.这将删除存储库中的node_modules
文件夹。 The command npm install
should work now.命令npm install
现在应该可以工作了。
If you are using Webpack, you can also remove the dist
folder using rm -r dist
and re-build your repository.如果您使用的是 Webpack,您还可以使用rm -r dist
删除dist
文件夹并重新构建您的存储库。
I had the same issue, i did following:我有同样的问题,我做了以下事情:
1. Restart system 1.重启系统
2. Close VS, VSCode or any editor that has JS files open. 2. 关闭 VS、VSCode 或任何打开了 JS 文件的编辑器。
3. Apparently, you might have to do npm install in other directories too before doing it in target folder. 3. 显然,在目标文件夹中执行之前,您可能还必须在其他目录中执行 npm install。
In my case, the ENOTEMPTY
followed an ERR_SOCKET_TIMEOUT
.就我而言, ENOTEMPTY
遵循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.它还带有重命名模块的指令( uuid
到uuid-<some string>
, nanoid
到nanoid-<some string>
) - 重命名会导致相同的问题,无论是否验证缓存。 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与此处给出的答案非常相似,但仅删除模块对我来说还不够
I get the below-mentioned error when trying to do NPM install in my Dockerfile.尝试在Dockerfile中安装NPM时出现以下错误。 I do delete node_modules before running NPM install still I end up with this error.我在运行NPM安装之前确实删除了node_modules,但最终还是遇到此错误。
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.它在我的本地Mac上似乎正常工作,但是在我的Jenkins服务器上,脚本失败。
Error message say that /nodejsAction/node_modules/setprototypeof
is not empty错误消息说/nodejsAction/node_modules/setprototypeof
不为空
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此错误表明要安装或更新 NPM 包,您必须删除特定目录
In my case it was with Reactjs and when I was trying to install react-boostrap.就我而言,它是使用 Reactjs 并且当我尝试安装 react-boostrap 时。
Solution解决方案
You should remove the node_modules directory in your project.您应该删除项目中的 node_modules 目录。 Run:跑:
or with superuser privileges或具有超级用户权限
sudo rm -r node_modules .须藤 rm -r 节点模块。 You need to enter your sudo password for this to work您需要输入您的 sudo 密码才能使用
Sometimes you may end up with a type error if you're working with React, when you run npm audit fix .有时,如果您使用 React,当您运行npm audit fix时,您可能最终会遇到类型错误。 Type error like this:像这样输入错误:
*npm ERR! code ERR_INVALID_ARG_TYPE*
If this is your case, you should replace your react-scripts version in package.json file to ^3.4.1 ( as this work for me )如果这是您的情况,您应该将 package.json 文件中的 react-scripts 版本替换为^3.4.1 (因为这对我有用)
Remove the node_modules again and rerun npm i再次删除 node_modules 并重新运行npm i
It should be fine when you run npm audit fix and you can continue installing your dependency当您运行npm 审计修复时应该没问题,您可以继续安装您的依赖项
rm -r node_modules && rm -r dist rm -r node_modules && rm -r dist
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.