3

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

1
  • did you try to simply zip the node_modules folder before packing it in the installer? Commented Nov 22, 2017 at 9:52

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

0

​This is common error which comes while copying node_modules folder within Window machine because of some large number of sub-directories and long file/folder names.

​In latest version of NPM, all dependent node_modules are installed at root folder and hence nested folders shouldn't be issue. ​C​an you try upgrading npm to latest version ​

Thanks (courtesy: Himanshu Jain)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.