【问题标题】:Unable to run NPM in MAC Terminal无法在 MAC 终端中运行 NPM
【发布时间】:2019-04-29 14:54:19
【问题描述】:

无法在 mac 中运行 npm,尝试卸载重新安装它。 (正确移除 NPM 并重新安装)。但每次我都低于错误。

Error: EEXIST: file already exists, mkdir '/usr/local/bin/npm'
TypeError: Cannot read property 'loaded' of undefined
    at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
    at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:77:20
    at cb (/usr/local/lib/node_modules/npm/lib/npm.js:225:22)
    at /usr/local/lib/node_modules/npm/lib/npm.js:263:24
    at /usr/local/lib/node_modules/npm/lib/config/core.js:83:7
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/npm/lib/config/core.js:82:13
    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:173:20)
/usr/local/lib/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 (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
    at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
    at process.emit (events.js:196:13)
    at process._fatalException (internal/process/execution.js:146:25)

当我输入 NPM 时,它应该运行,但我遇到了错误。

【问题讨论】:

  • NPM 文件的权限是:``` lrwxr-xr-x 1 root admin 38 Apr 29 09:36 npm -> ../lib/node_modules/npm/bin/npm-cli。 js```

标签: npm


【解决方案1】:

它似乎与用户权限有关。见这篇文章:npm error on every command: EEXIST: file already exists, mkdir 'c:\users\user\appdata\Roaming\npm'。您是否以 root 身份运行 npm 命令?

【讨论】:

    猜你喜欢
    • 2014-04-02
    • 1970-01-01
    • 2016-06-10
    • 1970-01-01
    • 1970-01-01
    • 2014-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多