由于嵌套节点依赖性,路径太长 [英] Too long paths because of nested node dependencies
问题描述
我正在使用npm安装依赖项.安装完这些文件后,我想与非技术人员并且没有npm共享我的项目,因此我想将node_modules交付到应用程序内.
I'm using npm to install dependencies. After I have installed those, I want to share my project with someone who is not technical, and doesn't have npm, so I want to ship the node_modules inside the app.
但是,由于节点嵌套了依赖关系,因此它会创建一个路径很长(217个字符)的文件
However, because node nests the dependencies, it creates a file that has a very long path (217 characters)
node_modules\express\node_modules\connect\node_modules\multiparty\node_modules\readable-stream\node_modules\string_decoder\build\node_modules\cheerio\node_modules\htmlparser2\node_modules\domhandler\test\cases\04-unescaped_in_script.json
问题(在Windows上)是,当最终用户尝试复制/粘贴文件名过长的文件夹时,他遇到以下错误:
The problem (on windows) is that when the end users tries to copy/paste the folder with too long filenames, he gets the following error:
例如是否可以告诉npm将依赖项安装在名为nm
的文件夹中
,这样问题就很可能不会出现.
Is it for example possible to tell npm to install the dependencies in a folder called nm
, so that the problem would more likely not appear.
推荐答案
为解决此问题,我会尝试:
To circumvent the problem, I would try:
-
映射到虚拟驱动器的路径.如果是网络共享 文件夹中,您可以使用工具->映射网络驱动器",如果没有,则可以使用 替代"命令.更多信息在这里: http://www.makeuseof.com/tag/how-to-map-a-local-windows-folder-to-a-drive-letter/
Mapping the path to a virtual drive. If it's a network-shared folder, you can use "Tools->Map Network drive", if not, you can use the "subst" command. More info here: http://www.makeuseof.com/tag/how-to-map-a-local-windows-folder-to-a-drive-letter/
由于问题仅是复制一组文件夹,为什么不尝试 Robocopy?它支持比本机更长的文件路径 Windows资源管理器.
Since the problem is just copying a set of folder, why not try Robocopy? It has support for longer filepaths than the native Windows Explorer.
这篇关于由于嵌套节点依赖性,路径太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!