VS2015 CTP6中嵌套的node_modules的"FullPath无法应用"错误

and*_*ter 7 npm asp.net-core-mvc visual-studio-2015

我正在使用Visual Studio 2015 CTP6中的MVC6 + Aurelia项目,并且遇到了一些有趣的事情.

node_modules默认情况下,我在项目根目录中,一切正常.但是,我希望保持源代码树更有条理和移动 node_modules,jspm_modules并将相关内容保存到子文件夹 - 例如.MyApp\client\node_modules等等

但现在Visual Studio停止加载项目.这是"VsProjectFault.failure.txt"的例外:

(Inner Exception #1) System.InvalidOperationException: The item metadata "%(FullPath)" cannot be applied to the path "client\node_modules\conventional-changelog\node_modules\lodash.assign\node_modules\lodash._basecreatecallback\node_modules\lodash.bind\node_modules\lodash._createwrapper\node_modules\lodash._basecreatewrapper\node_modules\". C:\Work\xxxxxxxxxx\xxxxxxxxxx.xxx\src\client\node_modules\conventional-changelog\node_modules\lodash.assign\node_modules\lodash._basecreatecallback\node_modules\lodash.bind\node_modules\lodash._createwrapper\node_modules\lodash._basecreatewrapper\node_modules\
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName, Object arg0, Object arg1, Object arg2)
   at Microsoft.Build.Shared.FileUtilities.ItemSpecModifiers.GetItemSpecModifier(String currentDirectory, String itemSpec, String definingProjectEscaped, String modifier, String& fullPath)
   ...
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Utilities.DataflowExtensions.<>c__DisplayClass37`2.<<CreateSelfFilteringTransformBlock>b__38>d__0.MoveNext()
Run Code Online (Sandbox Code Playgroud)

显然问题在于node_modules递归路径太长 - 并且节点跟踪器中存在错误#6960

Node需要一种替代方法来在Windows上无限的,递归嵌套的node_modules文件夹.大多数Windows工具,实用程序和shell无法处理最多超过260个字符的文件和文件夹路径.

...这似乎已经关闭,因为无法解决这个问题:

节点不会改变,所以这不是一个Node问题.问题不在于模块加载语义,而在于模块安装语义.(这两者是相关的,但不完全相同.)

但后来我不明白项目是如何加载的,因为有些路径肯定超过260个符号,即使node_modules是在项目根目录下!

在配置中是否有一些设置或某些东西可以帮助Visual Studio 2015加载项目node_modules,发生了什么?

Dar*_*eal 5

我通过使用组策略编辑器启用Win32 长路径策略,成功地在 Windows 10 开发计算机中修复了此问题。以下是所需的步骤(取决于您是否安装了周年更新):

\n\n

周年纪念更新之前

\n\n

如果您\xe2\x80\x99正在运行14352和RTM 1607之间的Windows 10版本,又名\xe2\x80\x9c周年更新\xe2\x80\x9c,则需要执行以下操作:

\n\n
    \n
  • 按并手动键入启动组策略编辑器,然后按键。Windows Keygpedit.mscEnter
  • \n
  • 导航到本地计算机策略>计算机配置>管理模板>系统>文件系统> NTFS
  • \n
  • 找到启用 NTFS 长路径选项并单击启用它。
  • \n
\n\n

作为替代方案,您还可以通过执行以下注册表命令来获得相同的结果:

\n\n
Windows Registry Editor Version 5.00\n\n[HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\FileSystem]\n"LongPathsEnabled"=dword:00000001\n\n[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem]\n"LongPathsEnabled"=dword:00000001\n
Run Code Online (Sandbox Code Playgroud)\n\n

周年更新后

\n\n

如果您\xe2\x80\x99正在运行周年更新后的Windows 10版本(RTM 1067或更高版本),则需要使用以下内容:

\n\n
    \n
  • 按并手动键入启动组策略编辑器,然后按键。Windows Keygpedit.mscEnter
  • \n
  • 导航到本地计算机策略>计算机配置>管理模板>系统>文件系统
  • \n
  • 找到该Enable Win32 long paths选项并单击启用它。
  • \n
\n\n

如果您需要更多详细信息,您还可以查看我就此主题撰写的这篇博文。

\n


ram*_*tan 4

http://bstruthers.com/weblog/2013/02/06/Cannot_evaluate_the_item_metadata_FullPath/

这是因为VS中文件路径的字符限制已经超出了。将文件夹复制到根文件夹中并尝试。