本文介绍了NPM不会在Mac上安装任何程序包。新的,干净的构建。 `EACCES`&安培;其他错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从头开始重建我的小牛(Mac OS X版本9.4)的机器。我是管理员,只有本机的用户。

I've just rebuild my Mavericks (Mac OS X Version 9.4) machine from scratch. I am the administrator and only user of this machine.


  • 我通过他们的的git-2.0.1-Intel的通用 - 雪 - leopard.pkg安装的Git ()>的/ usr /本地/ git的/ bin中/混帐位置。

  • 我通过他们的节点v0.10.30.pkg ()在其默认的/ usr / local / bin目录/节点位置。

  • 节点的安装程序包的最后一步包括一份说明,他们也以默认的/ usr / local / bin目录/ NPM 位置安装NPM。

  • 我的 $ PATH 回声的/ usr /本地/ git的/ bin中:在/ usr / bin中:/ bin中:/ usr / sbin目录:/ sbin目录:在/ usr / local / bin目录:在/ usr /本地/ git的/ bin中(包含的/ usr / local / bin目录)。

  • I installed Git via their git-2.0.1-intel-universal-snow-leopard.pkg (http://git-scm.com/downloads) in their default /usr/local/git/bin/git location.
  • I installed Node via their node-v0.10.30.pkg (http://nodejs.org/download/) in their default /usr/local/bin/node location.
  • The final step of Node's installer package included a note that they also installed NPM in their default /usr/local/bin/npm location.
  • My $PATH echoes /usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin (it contains /usr/local/bin).

运行 NPM安装-g亭子结果:

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/bower',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR!      'Object.oncomplete (fs.js:107:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! cwd /Users/Home
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.21
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! fstream_path /usr/local/lib/node_modules/bower
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/Home/npm-debug.log
npm ERR! not ok code 0

运行类似设施( NPM安装-g哟 NPM安装-g咕噜 NPM安装-g NVM NPM安装在这似乎是错误的同一列表-g NPM )的结果。

有几个人在网上提出强制通过须藤安装,但其他几个人警告说这可能会导致以后的问题。这些包的手册似乎不提须藤的要求,而且在某些情况下,当这个问题出现,他们已告知联系NPM。

Several people online suggest forcing the installation via sudo, but several others warn this could cause later issues. The manuals for these packages seem not to mention requirement of sudo, and in some cases, they have advised contacting NPM when this issue arises.

运行 NPM缓存清除不能解决问题。

运行 LS -la 在家里()目录显示我的Mac OS X用户名作为所有者我的 .npm 目录: drwxr-XR-×15行政人员510 08月11日23:53 .npm

Running ls -la in the home (~) directory shows my Mac OS X username as the owner of my .npm directory: drwxr-xr-x 15 admin staff 510 Aug 11 23:53 .npm

有谁知道出了什么问题,如何纠正呢?谢谢。

Does anyone know what has gone wrong and how to correct this? Thank you.

推荐答案

顺便说一句,我改变的业主解决了这个问题,在/ usr /本地做我自己,为了让故宫在其默认位置模块,而不需要进一步须藤每个软件包的安装。

By the way, I solved this issue by changing the owner of /usr/local to be myself, in order to allow NPM to modules in its default location without further requiring sudo for each package's installation.

sudo chown -R `whoami` /usr/local

这篇关于NPM不会在Mac上安装任何程序包。新的,干净的构建。 `EACCES`&安培;其他错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 00:29