Npm问题在error-handler.js

时间:2017-11-17 06:38:24

标签: javascript node.js npm error-handling

亲爱的Stackoverflow社区,

我已经安装了版本5.5.1的NPM。还有版本为8.9.0的节点但是,当我在命令行上键入npm时,会显示以下内容。

    Amornchots-MacBook-Pro:~ amornchotsingh$ npm -v
5.5.1
Amornchots-MacBook-Pro:~ amornchotsingh$ npm
Error: EPERM: operation not permitted, mkdir '/Usr/amornchotsingh'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
    at /Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/bin/npm-cli.js:83:20
    at cb (/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/npm.js:214:22)
    at /Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/npm.js:252:24
    at /Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/config/core.js:81:7
    at Array.forEach (<anonymous>)
    at /Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/config/core.js:80:13
    at f (/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at afterExtras (/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/config/core.js:178:20)
    at Conf.<anonymous> (/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/config/core.js:235:20)
/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/utils/error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
    at emitOne (events.js:116:13)
    at process.emit (events.js:211:7)
    at process._fatalException (bootstrap_node.js:374:26)
Amornchots-MacBook-Pro:~ amornchotsingh$ 

如何在error-handler.js文件中解决以下错误?

/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/utils/error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (/Users/amornchotsingh/.nvm/versions/node/v8.9.0/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
    at emitOne (events.js:116:13)
    at process.emit (events.js:211:7)
    at process._fatalException (bootstrap_node.js:374:26)

0 个答案:

没有答案