Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Unable to install node-sass globally on Linux #2216

Closed
kinlhp opened this issue Jan 17, 2018 · 1 comment
Closed

Unable to install node-sass globally on Linux #2216

kinlhp opened this issue Jan 17, 2018 · 1 comment

Comments

@kinlhp
Copy link

kinlhp commented Jan 17, 2018

NPM version.

5.6.0

Node version.

v9.4.0

Node process.

{ http_parser: '2.7.0',
node: '9.4.0',
v8: '6.2.414.46-node.17',
uv: '1.18.0',
zlib: '1.2.11',
ares: '1.13.0',
modules: '59',
nghttp2: '1.29.0',
openssl: '1.0.2n',
icu: '60.1',
unicode: '10.0',
cldr: '32.0',
tz: '2017c' }

Node platform.

linux

Node architecture.

x64

Repro steps.

npm install -g node-sass (as root)

The log given by the failure.

The following repeats itself forever:

/usr/bin/node-sass -> /usr/lib/node_modules/node-sass/bin/node-sass

> [email protected] install /usr/lib/node_modules/node-sass
> node scripts/install.js

Unable to save binary /usr/lib/node_modules/node-sass/vendor/linux-x64-59 : { Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/node-sass/vendor'
at Object.fs.mkdirSync (fs.js:905:18)
at sync (/usr/lib/node_modules/node-sass/node_modules/mkdirp/index.js:71:13)
at Function.sync (/usr/lib/node_modules/node-sass/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/usr/lib/node_modules/node-sass/scripts/install.js:111:11)
at Object. (/usr/lib/node_modules/node-sass/scripts/install.js:154:1)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/usr/lib/node_modules/node-sass/vendor' }

> [email protected] postinstall /usr/lib/node_modules/node-sass
> node scripts/build.js

Building: /usr/bin/node /usr/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/bin/node',
gyp verb cli '/usr/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which succeeded python2 /bin/python2
gyp verb check python version /bin/python2 -c "import platform; print(platform.python_version());" returned: "2.7.14\n"
gyp verb get node dir no --target version specified, falling back to host node version: 9.4.0
gyp verb command install [ '9.4.0' ]
gyp verb install input version string "9.4.0"
gyp verb install installing version: 9.4.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/9.4.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '9.4.0' ]
gyp verb install input version string "9.4.0"
gyp verb install installing version: 9.4.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 9.4.0
gyp verb ensuring nodedir is created /usr/lib/node_modules/node-sass/.node-gyp/9.4.0
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/node-sass/.node-gyp/9.4.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '9.4.0' ]
gyp verb install input version string "9.4.0"
gyp verb install installing version: 9.4.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 9.4.0
gyp verb ensuring nodedir is created /usr/lib/node_modules/node-sass/.node-gyp/9.4.0
AND INFINITE LOOP ...

Desired functionality.

Install to be working

Mention any other details that might be useful.

Same behavior in Ubuntu 16.04 LTS and Fedora 27

@diogovk
Copy link

diogovk commented Feb 19, 2018

I think this is a real node-sass problem, as I have no such problem with any other npm package, and I'm having the same problem as kinlhp.

This is NOT a permission problem, as the directory is not even created:

ls -la /usr/lib/node_modules/node-sass/.node-gyp/9.4.0
ls: cannot access '/usr/lib/node_modules/node-sass/.node-gyp/9.4.0': No such file or directory

I tried creating the directory, and trying to install it again, but the NPM process deletes the directory, and the problem continues.

Actually nevermind, sudo npm install --unsafe-perm -g node-sass worked for me.

@sass sass locked as resolved and limited conversation to collaborators Feb 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants