升级了node npm 下载现在报错

What I Wanted to Do

What Happened Instead

Reproduction Steps

Details

Platform Info

$ npm --versions
<!-- paste output here -->
$ node -p process.platform
<!-- paste output here -->

Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs\node_global’
TypeError: Cannot read property ‘loaded’ of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach ()
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:173:20)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get(’_exit’) : true
^

TypeError: Cannot read property ‘loaded’ of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
6.9.0

有人遇到这个问题吗?权限问题弄了没好还是解决不了

这个是npm 下载的问题
Unhandled rejection Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs\node_cache_cacache’
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community

What do these show?

npm -g prefix
npm config list

我安装别的依赖会报错误信息:
错误信息如下:
Unhandled rejection Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs\node_cache’

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community

我就升级了一下 node 配置了环境的变量就出现这个问题了

这是
C:\Users\zhang>npm -g prefix
C:\Program Files\nodejs\node_global

C:\Users\zhang>npm config list
; cli configs
metrics-registry = “https://registry.npm.taobao.org/
scope = “”
user-agent = “npm/6.9.0 node/v10.16.0 win32 x64”

; userconfig C:\Users\zhang.npmrc
cache = “C:\Program Files\nodejs\node_cache”
prefix = “C:\Program Files\nodejs\node_global”
registry = “https://registry.npm.taobao.org/

; builtin config undefined

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\zhang
; HOME = C:\Users\zhang
; “npm config ls -l” to show all defaults.

这是我更改了环境变量后路径 C:\Program Files\nodejs\node_modules
错误信息message:

Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs\node_global’
TypeError: Cannot read property ‘loaded’ of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach ()
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:173:20)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get(’_exit’) : true
^

TypeError: Cannot read property ‘loaded’ of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
6.9.0