Revisiting ASP.NET compiler error caused by node_modules and Visual Studio

The first time I saw this issue was prior to npm version 3 being installed with Node.js. I wrote about it then and it continues to be one of my most popular postsThe latest version of Node.js includes version 3 of npm (and has for a while now), which stores modules in a flat structure to fix the Windows file name limit. I thought this would be the end of this

ASPRUNTIME: 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.

ASP.NET compiler error, but it has occurred since so it is time to revisit it.

The latest appearances have been on developer’s machines, not the build server. Our build server uses npm version 3 and has not had any issues since I updated it to that. Investigating the errors revealed that once again the node_modules were nested, but the developer’s had the latest version of Node.js installed and running npm proved that it was version 3.

The problem was that Visual Studio had installed the node_modules using its own version (older) of npm. The solution in these cases was to delete the node_modules folder and issue the “npm install” command manually through a command prompt.

It’s frustrating that Visual Studio is still using an older version of npm, especially since the flattening of the node_modules folder was done to benefit Windows users. If you wish to still install modules through Visual Studio you may want to investigate http://jameschambers.com/2015/09/upgrading-npm-in-visual-studio-2015/ and http://scottaddie.com/2015/08/16/npm-vs-windows-max_path-limitation/.

Advertisements
Revisiting ASP.NET compiler error caused by node_modules and Visual Studio

One thought on “Revisiting ASP.NET compiler error caused by node_modules and Visual Studio

Comments are closed.