It is not only when using npm under Windows that you come across a limit that is now almost 30 years old, which limits the paths to folders and files to a maximum of 255 characters. This is not NTFS's fault, but LFN . This leads to annoying bugs and incompatibility between operating systems. In the times of WSL this is a regrettable condition, which luckily you can fix yourself in the registry for some time.
Even on a current Windows 10 Pro 1709, you get this message when creating a folder / file path that is too long:
After the Anniversary Update of Windows 10 you can finally lift this limit. You should be aware that older software may no longer be able to access files that are outside of this limit. Not every 32-bit software is affected here and you can let it come down to a test. You navigate to the key with regedit
and creates (if it does not already exist) the DWORD value (32-bit) LongPathsEnabled and set the value to 1.
After a restart the change is active. Unfortunately, the Windows Explorer does not support longer paths at the moment (hopefully this will change in the future), but you can use more powerful tools like One Commander, which now supports paths with a character length of 32767 characters.