简体   繁体   English

ENOTEMPTY:目录不为空,重命名 '' -> '' (JavaScript + NPM + Ubuntu 服务器)

[英]ENOTEMPTY: directory not empty, rename '' -> '' (JavaScript + NPM + Ubuntu server)

Alright, so I've been making a bot for a popular Teamspeak-like program called discord.好的,所以我一直在为一个名为 discord 的流行的类似 Teamspeak 的程序制作一个机器人。 I'm running the bot on an Ubuntu server, and use NPM install to install various modules.我在 Ubuntu 服务器上运行机器人,并使用 NPM install 安装各种模块。

Currently, the local version of the bot works fine, but on Ubuntu I can't seem to do "sudo npm install urban" (Urban being the only module I'm having problems with - https://www.npmjs.com/package/urban )目前,本地版本的机器人工作正常,但在 Ubuntu 上我似乎无法执行“sudo npm installurban”(城市是我遇到问题的唯一模块 - https://www.npmjs.com/包/市区)

The error I get is我得到的错误是

npm ERR! Linux 4.2.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "urban"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! path /var/www/chatbot/node_modules/urban
npm ERR! code ENOTEMPTY
npm ERR! errno -39
npm ERR! syscall rename
npm ERR! ENOTEMPTY: directory not empty, rename '/var/www/chatbot/node_modules/urban' -> '/var/www/chatbot/node_modules/.urban.DELETE'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/chatbot/npm-debug.log

When I cd to the node_modules folder and do ls, there isn't even an urban folder I could work with.当我 cd 到 node_modules 文件夹并执行 ls 时,甚至没有我可以使用的城市文件夹。

I am relatively new to programming, so I'm sorry if I missed anything, I'll gladly add more information if needed.我对编程比较陌生,所以如果我错过了什么,我很抱歉,如果需要,我很乐意添加更多信息。 Thanks in advance, guys.提前致谢,伙计们。

I was receiving the same error message:我收到了同样的错误信息:

ENOTEMPTY, rename '/Users/name/Desktop/bot/node_modules/.request.DELETE' ENOTEMPTY,重命名'/Users/name/Desktop/bot/node_modules/.request.DELETE'

I just deleted the folder (node_modules/.request.DELETE/) and then ran npm install and everything seems to be working properly.我刚刚删除了文件夹 (node_modules/.request.DELETE/),然后运行npm install ,一切似乎都正常工作。

我只是删除了node_modules文件夹并再次运行npm install ;)

This is because there is a hidden folder with a .DELETE extension present in your node_modules folder, Just follow these steps,这是因为node_modules文件夹中存在一个.DELETE扩展名的隐藏文件夹,只需按照以下步骤操作,

Open Terminal (click Go > Utilities and double-click the Terminal app)

Now copy, and paste both lines listed below into Terminal one at a time, and press Return after each line:现在将下面列出的两行一次复制并粘贴到终端中,然后在每一行后按回车键:

defaults write com.apple.finder AppleShowAllFiles YES

killall Finder

Mac will now show all the hidden folders, delete your module folder with .DELETE extension and try Mac 现在将显示所有隐藏文件夹,删除扩展名为.DELETE的模块文件夹并尝试

npm install <packagename>

Use sudo if errors如果出现错误,请使用sudo

sudo npm install <package>

That's it.就是这样。 You should be able to install.你应该可以安装。

In my case node process was locking the folder.在我的情况下,节点进程正在锁定文件夹。 I used我用了

lsof | grep DELETE

to find this out.找出这个。 So I just stopped webpack-dev-server that was running the process and continued with所以我只是停止了运行该进程的webpack-dev-server并继续

npm install

So check what process is locking the file/folder, then decide how to fix this因此,请检查锁定文件/文件夹的进程,然后决定如何解决此问题

I was facing the issue while running我在跑步时遇到了这个问题

ng build --watch

but after trying但在尝试之后

npm install

Fixed!固定的!

I faced the same problem.我遇到了同样的问题。 Actually there is a file or folder with .DELETE extension in your node_modules folder.实际上,您的 node_modules 文件夹中有一个扩展名为 .DELETE 的文件或文件夹。

You can force delete the file or folder with .DELETE extension.您可以强制删除扩展名为 .DELETE 的文件或文件夹。 Or if you are working on your local machine, issue can be fixed by delete the node_modules folder and reinstalling the packages by following command或者,如果您在本地计算机上工作,则可以通过删除node_modules文件夹并通过以下命令重新安装软件包来解决问题

npm install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM