我遇到了一个奇怪的问题——显然是某个 node .js模块有deep folder hierarchies个,当路径长度超过250个字符时,Windows copy命令(或我们实际使用的PowerShell的Copy-Item
)会出现臭名昭著的"路径过长"错误.
例如,这是单个 node 模块可以创建的文件夹层次 struct :
node_modules\nodemailer\node_modules\simplesmtp\node_modules\
xoauth2\node_modules\request\node_modules\form-data\node_modules\
combined-stream\node_modules\delayed-stream\...
这看起来很疯狂,但在 node 模块中却是现实.
我们需要在部署期间使用复制粘贴(我们没有使用像Heroku这样的"聪明"目标平台,Git部署将是一个选项),这对Windows是一个严重的限制.
Isn't there a npm command or something that would compact the 100 folder or maybe include only what's actually necessary at runtime?( node 模块通常包含test
个文件夹等,我们不需要部署.)还有其他解决方法吗?不幸的是,不使用Windows不是一个选项:)