Downloading online NPM resources works fine while installation and service is installed successfully.
But when we pack Node_modules folder with installer... It throws folder path too long error while copying and unzipping offline downloaded node_modules files. Now Issue comes when client machine does not have internet and we wish to package it with installer.
How will we do it.
File Path too long / Folder path too long
You can disable the 260-character MAX_PATH limit in Windows 10.
A registry key allows you to enable or disable the new long path behavior. To enable long path behavior set the registry key at HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled (Type: REG_DWORD). The key's value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (list follows). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.
The registry key can also be controlled via Group Policy at Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths.
You can also enable the new long path behavior per app via the manifest
MSDN (updated link)
You may also achieve a reduced folder depth using npm dedupe.
Another way you can get around this is to just install it firstly to the shortest path you can get away with :) This means not accepting the default package path when extracting i.e.
C:\users\myuser\node-v8.11.2-win-x64
But for example:
C:\users\myuser\node
This worked for me when I came across the same issue.
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