【发布时间】:2020-02-21 04:00:57
【问题描述】:
我在解决“ionic: command not found”问题时遇到了问题。
我发现建议尝试的帖子:npm config set prefix /usr/local。
但我不小心输入了“npm config set prefix /usr/loca”。
现在,如果我尝试运行任何 npm 命令,它只会抛出错误:
Error: EPERM: operation not permitted, mkdir '/usr/loca'
TypeError: Cannot read property 'get' of undefined
at errorMessage (/usr/local/lib/node_modules/npm/lib/utils/error-message.js:38:39)
at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:201:13)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:78: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:81:7
at Array.forEach (<anonymous>)
at /usr/local/lib/node_modules/npm/lib/config/core.js:80: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:171:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97
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:97:27)
at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at process.emit (events.js:210:5)
at process._fatalException (internal/process/execution.js:150:25)
有什么办法可以解决吗?
非常感谢!
【问题讨论】:
-
你有没有发现我面临同样的问题
-
我认为是版本问题。我想我尝试了一个较旧的 npm 版本最终奏效了。
-
编辑你的 ~/.npmrc 来重置前缀是否足够?
标签: node.js ionic-framework npm npm-install