LoginSignup
26
21

More than 5 years have passed since last update.

Ubuntuにnode-sassを入れようとしたらつまづいた話

Posted at

Rubyアレルギー(超偏見)なので、Ruby製のsassを使いたくなくてnode-sassを入れようとしたらつまづいたので備忘録

インストールコマンドは以下になるんですが。。。
npm install -g node-sass

実行すると、このようなエラーが。。。

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/build'
gyp ERR! System Linux 4.4.0-83-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /usr/local/lib/node_modules/node-sass
gyp ERR! node -v v8.1.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.5.3 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.5.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/(ユーザー名)/.npm/_logs/2017-07-16T08_46_15_890Z-debug.log

permission denied?

ということで、sudoを付けて再度実施してみましたが変わらず。。。

いろいろ調べながら、バージョンアップとかキャッシュクリーンしてみたけど変わらず。。。

最終的に以下2コマンドを実施して、再度インストールを試みたら入ったっぽい。。。
結局、原因は分からず。。。

npm config set user 0
npm config set unsafe-perm true

実施した全コマンド

npm cache clean -f
npm install -g npm
npm install -g n
n latest
npm install -g node-gyp
npm config set user 0
npm config set unsafe-perm true
26
21
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
26
21