npm安装错误EACCES权限被拒绝?

时间:2017-06-22 12:53:32

标签: npm install

我使用npm有权限问题。 当我写" npm install"

Error: EACCES: permission denied, mkdir '/ItsMe'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211:17)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:83:20
    at cb (/usr/local/lib/node_modules/npm/lib/npm.js:215:22)
    at /usr/local/lib/node_modules/npm/lib/npm.js:253:24
    at /usr/local/lib/node_modules/npm/lib/config/core.js:81:7
    at Array.forEach (native)
    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:178:20)
    at Conf.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/core.js:235:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211
  if (npm.config.get('json')) {
                ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211:17)
    at emitOne (events.js:96:13)
    at process.emit (events.js:191:7)
    at process._fatalException (bootstrap_node.js:304:26)

使用&#34; ls -l&#34;我有rwx权利。 我不明白什么&#34;无法阅读财产&#39;得到&#39;未定义&#34;装置

我在网上搜索并尝试了几件事,但事实并非如此。不起作用。 你能帮帮我吗?

谢谢

1 个答案:

答案 0 :(得分:1)

您的npm install尝试在您无法访问的文件中执行mkdir。尝试通过

给他正确的权利
sudo npm install

或以超级用户的身份做这件事(我不再重述)你还问了npm install没有争论的事情。好吧,如果你没有指定一个文件夹,它就会创建文件夹node_module(这就是为什么它会创建一个mkdir)。如果您没有精确模块,它将安装package.json的所有模块。这可能需要花费时间,你将获得许多你不会需要的套餐,但是你将确保拥有你想要的套餐。

如果你确切知道它,你可以选择你想要的包装。即:

npm install sax@latest

latest意味着它会搜索最后一个现有的包

您还可以安装自己下载的软件包。即:

npm install ./package.tgz
相关问题