Folder path too long issue in installing Node.js b

2019-05-26 22:37发布

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

3条回答
闹够了就滚
2楼-- · 2019-05-26 22:59

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.

查看更多
太酷不给撩
3楼-- · 2019-05-26 23:00

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

You may also achieve a reduced folder depth using npm dedupe.

查看更多
Bombasti
4楼-- · 2019-05-26 23:16

​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)

查看更多
登录 后发表回答