gpt4 book ai didi

node.js - Windows 上的 Node 错误 : "Source Path Too Long"

转载 作者:可可西里 更新时间:2023-11-01 13:28:32 25 4
gpt4 key购买 nike

解释:node_modules 中大约有 15 个子文件夹目录。当要执行任何操作(删除、移动或重命名)时,它会在消息下方弹出。

错误信息:

The source file name(s) are larger than is supported by the filesystem. Try moving to a location which has a shorter path name, or tryrenaming to shorter name(s) before attempting this operation.

截图: enter image description here

内的子文件夹 npm_modules 目录。

node_modules\gulp-connect\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-expression-parse\node_modules\spdx-license-ids\spdx-license-ids.json

到目前为止已尝试:

我还尝试使用命令 rmdir <dirname> /S 在命令提示符下删除文件夹 (node_modules)但效果不佳。

enter image description here

有一种方法可以做到这一点,即逐个子文件夹进入子文件夹,将每个文件夹重命名为类似“b”的短名称。最终路径足够短以允许删除。这会浪费很多时间。

有没有什么有效的方法可以删除这个node_modules目录?

最佳答案

npm 的最新版本修复了这个扁平化路径的问题:https://github.com/npm/npm/issues/3697 .

尝试

D:\vms\fe> robocopy d:\path\to\temp\dir node_modules /purge

删除嵌套目录。

更新

正如 Coding Professor 所指出的, 另一种选择是使用 rimraf util(基本上调用 rm -rf):

> npm install -g rimraf
> rimraf node_modules

关于node.js - Windows 上的 Node 错误 : "Source Path Too Long",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37145805/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com