在尝试删除npm install创建的node_modules目录时:
源文件名大于该文件支持的文件名 系统。尝试移动到路径名称较短的位置,或者尝试 在尝试此操作之前,将名称重命名为较短的名称
我也尝试了shift + delete,仍然有同样的问题。
在尝试删除npm install创建的node_modules目录时:
源文件名大于该文件支持的文件名 系统。尝试移动到路径名称较短的位置,或者尝试 在尝试此操作之前,将名称重命名为较短的名称
我也尝试了shift + delete,仍然有同样的问题。
当前回答
我也遇到过类似的问题,由于一些未知的原因,RD没有工作。
NPM可以摆脱它自己的混乱,所以如果你为node_modules中的每个目录执行NPM uninstall [module-name],你就可以摆脱它们了。
(对于那些有很多依赖关系的人,我将在后面查找如何批量循环。)
其他回答
什么都试过了,但都没用。以上所有方法都不起作用。最后,我能够通过VSCode删除。
用VSCode打开你的根文件夹。 选择“node_modules”文件夹并删除。 利润。(删除需要几毫秒。)
因为这是谷歌的结果,这是对我有用的:
更新,如果你有npm v5,使用npx:
- npx rimraf . - **/ node_模块
否则安装RimRaf:
NPM安装rimraf
在项目文件夹中删除node_modules文件夹:
rimraf node_modules
如果你想递归删除:
rimraf \ * * \ node_modules
[http://www.nikola-breznjak.com/blog/nodejs/how-to-delete-node_modules-folder-on-windows-machine/]
我还没有在其他操作系统上测试过
rm -r node_modules
事实上,你可以用它删除任何文件夹。
比如rm -r anyfolderwherhisnotdeletablefromshiftdeleteordelete。
只需打开github移动到文件夹的根目录并运行此命令
希望这能有所帮助。
谢谢, Ajay Kotnala
尝试Visual Studio代码
在尝试了许多解决方案后,我发现这是相当简单的。 只需在Visual code中打开项目并删除它。UI可能会冻结几秒钟,但它肯定会工作。我使用许多大尺寸的node_modules文件夹进行测试
谢谢
我使用的一个解决方案是:
(我更倾向于在使用CI环境时避免安装新的扩展(rimraf)。)
A) Rename packages.json to something else. B) Specially on CI - after npm install, I usually remove the file instead of renaming it, but if you need it, you don't have to do this. That's your choice. run npm init - this will create an empty packages.json file (no dependencies) run npm prune - this will match node_modules with the dependencies section of packages.json - which is now empty as the result of step #2. If you have chosen #1.A. step, delete the newly created packages.json, and rename original packages.json back to its original name.