15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Bowerのインストールで「Error: EACCES〜」が発生した場合の対処

Last updated at Posted at 2015-01-30

Bowerをインストールしてみようとしたところ、早速エラーが出たので、対処した作業ログを。
~/.npmにある幾つかのファイルの所有者がrootになってたのが原因だった模様。

# yuto-ogi [11:53:22]
$ npm install bower -g
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "bower" "-g"
npm ERR! node v0.10.36
npm ERR! npm  v2.3.0
npm ERR! path /Users/yuto-ogi/.npm/graceful-fs/3.0.5
npm ERR! code EACCES
npm ERR! errno 3

npm ERR! Error: EACCES, mkdir '/Users/yuto-ogi/.npm/graceful-fs/3.0.5'
npm ERR!  { [Error: EACCES, mkdir '/Users/yuto-ogi/.npm/graceful-fs/3.0.5']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/yuto-ogi/.npm/graceful-fs/3.0.5',
npm ERR!   parent: 'bower' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/yuto-ogi/Dropbox/Public/source/npm-debug.log

確認してみると、そこにはrootパーミッションに設定されたgraceful-fsが。

# yuto-ogi [11:53:34]
$ ll ~/.npm
~
drwxr-xr-x   4 root      staff   136 11  3 15:50 graceful-fs
~

ということで、所有者をログインユーザーに変更します。

# yuto-ogi [11:54:38]
$ sudo chown -R yuto-ogi ~/.npm/

リトライ。

# yuto-ogi [11:54:44]
$ npm install bower -g
/usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower
bower@1.3.12 /usr/local/lib/node_modules/bower
├── is-root@1.0.0
├── junk@1.0.0
├── stringify-object@1.0.0
├── abbrev@1.0.5
├── chmodr@0.1.0
├── which@1.0.8
├── osenv@0.1.0
├── archy@0.0.2
├── opn@1.0.1
├── rimraf@2.2.8
├── bower-logger@0.2.2
├── bower-endpoint-parser@0.2.2
├── lru-cache@2.5.0
├── graceful-fs@3.0.5
~

無事インストールできました!

# yuto-ogi [11:54:44]
$ bower -v
1.3.12

今回は~/.npmの所有者をゴソっと直しちゃったけど、自分のユーザーディレクトリ直下なのに、~/.npm/に所有者がrootのディレクトリが幾つかあったのが解せん。。。
node/npmはあんまり触ったことないので、もっとスマートなやり方があれば知りたいですね。

15
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?