I was using Visual Studio 2015 update 3 on Windows 10 x64 and was getting the error: “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.”, when running some gulp tasks.
I fixed the problem by letting Visual Studio 2015 update 3 use the “current”(at the time of writing) node version (v6.5.0), that was installed in “C:\Program Files\nodejs”.
- Download the “current” (v6.5.0) Windows x64 version of node (NOT, I repeat, NOT the LTS version) at https://nodejs.org/en/
- Install it
- Open Visual Studio 2015 > Tools > Options… > Project and Solutions > External Web Tools > Add an entry “C:\Program Files\nodejs”
- Move the entry to the top of the list and restart visual studio:
No the following steps might not be necessary, but in case the error persists:
- Remove the node_modules folder
- Open the solution and project (this will trigger an npm install)
- Open the Package Manger Console
- npm cache clean
- npm dedupe
- npm install