10

When trying to hit the command : npm install -g @angular/cli@6.1.1

Note: I have Node.Js LTS 10.xx version, .Net Framework 4.7.2 Developer pack, and all necessary extensions in place.

Error thrown:

npm ERR! code ELOOP
npm ERR! syscall stat
npm ERR! path \\horofs**\users$\
npm ERR! errno -62
npm ERR! ELOOP: too many symbolic links encountered, stat '\\horofs06\users$\'

npm ERR! A complete log of this run can be found in:
npm ERR!     \\horofs**\users$\W****\AppData\Roaming\npm-cache\_logs\2020-07-31T13_26_25_468Z-debug.log

The log states this:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   '@angular/cli@6.1.1' ]
2 info using npm@6.14.6
3 info using node@v10.22.0
4 verbose npm-session 8b2e687260b66580
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/@angular%2fcli 282ms (from cache)
8 silly pacote version manifest for @angular/cli@6.1.1 fetched in 426ms
9 verbose stack Error: ELOOP: too many symbolic links encountered, stat '\\horofs**\users$\'
9 verbose stack     at eloop (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:58:17)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:19:11)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
9 verbose stack     at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
10 verbose cwd C:\Cqe\Periscope\src\Periscope\Endava.Periscope.Web
11 verbose Windows_NT 6.3.9600
12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli@6.1.1"
13 verbose node v10.22.0
14 verbose npm  v6.14.6
15 error code ELOOP

Please help me.

Subham Mitra
  • 101
  • 1
  • 1
  • 4

3 Answers3

5

I met a similar issue and the log said as following,

error ELOOP: too many symbolic links encountered, chmod '/Users/myname/projects/my-electron-app/node_modules/electron/cli.js'
error ELOOP: too many symbolic links encountered, open '/Users/myname/projects/my-electron-app/node_modules/electron/npm-shrinkwrap.json'

When I checked my folder and found the folder electron link to itself, so it led to a never-ending loop.

lrwxr-xr-x    1 myname  staff      8 Feb 20 11:42 electron@ -> electron

I checked the size and directly removed the file, then used npm install electron again. It finally worked.

So please check the link, it looks that the file in your application links to itself too.

I doubt that it should be an issue about npm because npm tries to create a link before the file is actually downloaded.

Song Bi
  • 729
  • 1
  • 7
  • 11
2

You can judge for yourself below. The disappointing situation is that you may not be able to use NodeJS when your User data is stored in a folder with more than 2,000 subfolders. Like you, my User folder is stored on a network drive instead of C: In "readGlobalPackageData()," the value of self.where is passed to readPackageTree. In my case, self.where = "\[domain]\users$[office location][userID]\AppData\npm." Code in realpathCached() is backing out of that path and trying to read all subfolders as it goes. When it gets to "\[domain]\users$", the "ELOOP" error is logged because there's a max depth of 2000, and my company's Users folder has more than 25,000 subfolders.

Here are two possible solutions: First, remove -g from the install command to make the install local to the folder for your new app. The downside is that if there's an update to one of the dependencies, you'll have to install it manually everywhere you didn't use -g. That can be good if an update contains breaking changes.

Second, and I don't recommend this solution, is to edit one of the installer files. The installer is reading all the ID folders in your User folder and it's only failing because an arbitrary limits was reached. If you increase the limit, the error should go away but you're also letting the script read all the user IDs on your network. Try this at your own risk. Open this file: C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js. On line 18, "if (depth > 2000)," change 2000 to a number greater than the number of folders under your users$ (share) folder.

Dharman
  • 30,962
  • 25
  • 85
  • 135
1

As answered by Classic Craig

You can judge for yourself below. The disappointing situation is that you may not be able to use NodeJS when your User data is stored in a folder with more than 2,000 subfolders. Like you, my User folder is stored on a network drive instead of C: In "readGlobalPackageData()," the value of self.where is passed to readPackageTree. In my case, self.where = "[domain]\users$[office location][userID]\AppData\npm." Code in realpathCached() is backing out of that path and trying to read all subfolders as it goes. When it gets to "[domain]\users$", the "ELOOP" error is logged because there's a max depth of 2000, and my company's Users folder has more than 25,000 subfolders.

I also cannot install Angular globally on my user folder on my company's mainframe. I work around this by installing it locally.

First I initialized the installation location with

npm init

and by going to the directory within the node_modules I accessed .bin folder

cd ../node_modules/.bin

The ng command can be run within the .bin folder. Then I used ng new to create a new project within the .bin folder. Then, I can use the

npm run ng <command>

here. So I can use the ng command within the project folder.