I'm playing around with MVC6 + Aurelia project in Visual Studio 2015 CTP6, and came across something interesting.
My node_modules
is by default in the project root and everything works fine. However, I'd like to keep source tree a bit more organized and moved node_modules
, jspm_modules
and related stuff to a subfolder - eg. MyApp\client\node_modules
etc.
But now Visual Studio stops loading the project. Here's exception from "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()
Apparently the problem is in node_modules
recursive path being too long - and there's bug #6960 in Node tracker
Node needs an alternative approach to endless, recursively nested node_modules folders on Windows. Most Windows tools, utilities and shells cannot handle file and folder paths longer than 260 characters at most.
...which seems like closed as won't fix to me:
Node isn't going to change, so this isn't really a Node issue. The problem is not with the module loading semantics, but with the module installation semantics. (The two are related, but not identical.)
But then I don't understand how come the project was loading in the first place, because some paths are definitely over 260 symbols even if node_modules
is under the project root!
Is there some setting in config or something which helps Visual Studio 2015 to load the project with node_modules
, what's going on?