I have a problem with the node_modules folder created by npm.
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
A solution was to install npm@3 as it has the --flat parameter which flattens the folder. This is good.
Now I am using Task Runner Explorer in VS2015. Default it npm to install modules without the "--flat" option. The result is that I cannot publish the web project because the path exceeds the limit (even when the node_modules folder is added to ExcludeFoldersFromDeployment property in the project file), the error message is:
The "CollectFilesinFolder" task failed unexpectedly
A solution is to manually call npm install --flat but than my co-workers will have the same problem (and I am not talking about getting the folder removed from the file system :-/).
Is there a way to configure the parameters of the npm install, either by configuring Taks Runner Explorer or maybe in the package.json?
Per the current NPM documentation (v3.3.9), npm install doesn't have a --flat
command-line option. As far as I can tell, NPM v3 always installs modules in a flat directory structure (you can tell by doing a command-line install).
To ensure Visual Studio runs its commands with your version of node/npm, you will need to:
cd C:\path\to\nodejs\ && npm install npm@3
$(PATH)
above all the $(DevEnvDir)...
options.As a sanity-check, open the Interactive Node window and execute .npm version
. It should output an object with an "npm" property that equals npm --version
.
You should now be able to NPM-install inside Visual Studio using npm @3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With