Environment: Windows 10, network user, npm@6.14.8, node@12.20.0
Steps to recreate: Either install any npm package globally or update npm globally.
This problem is very similar, in fact the same as this SOF question.
Here is the error message in the terminal. I am copy-pasting the other question's error message and logs. The values are the exact same. Both of us were network users:
$ npm update -g
npm ERR! code ELOOP
npm ERR! syscall stat
npm ERR! path \\fs2.my.company.com\Home\
npm ERR! errno -62
npm ERR! ELOOP: too many symbolic links encountered, stat '\\fs2.my.company.com\Home\'
npm ERR! A complete log of this run can be found in:
npm ERR! \\fs2.my.company.com\Home\MyAccount\AppData\Roaming\npm-cache\_logs\2020-12-09T17_30_03_007Z-debug.log
And here is the referenced log file:
0 info it worked if it ends with ok
1 verbose cli [
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 'update',
1 verbose cli '-g'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.15.1
4 verbose npm-session a666bee41aec0454
5 verbose update computing outdated modules to update
6 verbose stack Error: ELOOP: too many symbolic links encountered, stat '\\fs2.my.company.com\Home\'
6 verbose stack at eloop (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:58:17)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:19:11)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
6 verbose stack at realpathCached (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-tree\realpath.js:39:10)
7 verbose cwd C:\Users\MyAccount
8 verbose Windows_NT 10.0.17763
9 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "update" "-g"
10 verbose node v14.15.1
11 verbose npm v6.14.8
12 error code ELOOP
13 error syscall stat
14 error path \\fs2.my.company.com\Home\
15 error errno -62
16 error ELOOP: too many symbolic links encountered, stat '\\fs2.my.company.com\Home\'
17 verbose exit [ -62, true ]
My guess is that the problem occurs due to me being a network ActiveDirectory user. The solution was to overwrite the cache and prefix of npm in npmrc. I found out my npmrc file is located in "C:\Program Files\nodejs\node_modules\npm\npmrc".
So I am writing in this npmrc file the new cache and prefix values:
prefix=C:\Program Files\nodejs\node_modules\npm
cache=C:\Program Files\nodejs\npm-cache
There was no "npm-cache" folder in that location. I think the cache location is wrong here. I got this from: this SOF answer. I am also trying cache=\\company.com\users\username\AppData\Roaming\npm-cache
.
I am getting a new permission error:
$ npm install node-windows -g
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\npm\node_modules\.staging
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\npm\node_modules\.staging'
npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\npm\node_modules\.staging'] {
npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\npm\node_modules\.staging'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\.staging'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\.staging',
npm ERR! parent: 'node-windows'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
So, OS is not allowing me to create the ".staging" folder in C:\Program Files\nodejs\node_modules\npm\node_modules
.
I am sure I have the wrong values for cache and prefix paths. I think the npmrc location is the right one.
Any help is appreciated. Thank you in advance.