npm -v):5.0.3 & 5.3.0node -v):8.1.4node -p process.versions):{ http_parser: '2.7.0',
node: '8.1.4',
v8: '5.8.283.41',
uv: '1.12.0',
zlib: '1.2.11',
ares: '1.10.1-DEV',
modules: '57',
openssl: '1.0.2l',
icu: '59.1',
unicode: '9.0',
cldr: '31.0.1',
tz: '2017b' }
node -p process.platform):linux (Linux Mint latest)node -p process.arch):x64node -p "require('node-sass').info"):node-sass 4.5.3 (Wrapper) [JavaScript]
libsass 3.5.0.beta.2 (Sass Compiler) [C/C++]
npm ls node-sass):/usr/lib
└── [email protected]
When encountering a syntax, or compilation issue:
LibSass. YouIf you delete this text without following it, your issue will be closed.
I first encountered this issue this morning when installing an npm package that requires node-sass. The npm pakage is installed gloablly and named quilk (https://www.npmjs.com/package/quilk) .
The install was on a linux mint desktop with a fresh install of node 8.1.4.
npm install -g quilk, most of its dependencies installed seemingly ok with the exception of node-sass. When it came to installing node-sass it started spewing out in a loop lines like this (baring in mind i ran all of this as root):
npm install -g quilk
npm WARN deprecated [email protected]: Use uuid module instead
/usr/bin/quilk -> /usr/lib/node_modules/quilk/bin/quilk.js
> [email protected] install /usr/lib/node_modules/quilk/node_modules/node-sass
> node scripts/install.js
Unable to save binary /usr/lib/node_modules/quilk/node_modules/node-sass/vendor/linux-x64-57 : { Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/quilk/node_modules/node-sass/vendor'
at Object.fs.mkdirSync (fs.js:890:18)
at sync (/usr/lib/node_modules/quilk/node_modules/mkdirp/index.js:71:13)
at Function.sync (/usr/lib/node_modules/quilk/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/usr/lib/node_modules/quilk/node_modules/node-sass/scripts/install.js:111:11)
at Object.<anonymous> (/usr/lib/node_modules/quilk/node_modules/node-sass/scripts/install.js:154:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/usr/lib/node_modules/quilk/node_modules/node-sass/vendor' }
> [email protected] postinstall /usr/lib/node_modules/quilk/node_modules/node-sass
> node scripts/build.js
Building: /usr/bin/nodejs /usr/lib/node_modules/quilk/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
...
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp/8.1.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp/8.1.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp/8.1.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp/8.1.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/quilk/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
Before assuming this was the fault of node-sass, i removed the quilk folder in the global node_modules and then tried to sudo npm install node-sass -g. I got pretty much the exact same result:
npm install -g node-sass
/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-57 : { Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/node-sass/vendor'
at Object.fs.mkdirSync (fs.js:890: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.<anonymous> (/usr/lib/node_modules/node-sass/scripts/install.js:154:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458: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/nodejs /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/nodejs',
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 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.12\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.1.4
gyp verb command install [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
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/8.1.4"
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 [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/node-sass/.node-gyp/8.1.4"
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 [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/node-sass/.node-gyp/8.1.4"
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 [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/node-sass/.node-gyp/8.1.4"
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 [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/node-sass/.node-gyp/8.1.4"
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 [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/node-sass/.node-gyp/8.1.4"
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 [ '8.1.4' ]
gyp verb install input version string "8.1.4"
gyp verb install installing version: 8.1.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.1.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/node-sass/.node-gyp/8.1.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/node-sass/.node-gyp/8.1.4"
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 [ '8.1.4' ]
gyp verb install input version string "8
I tried this with both npm default install of 5.0.3 and updating it to npm 5.3.0, both got the same result. Root doesn't have access to the global folder, ls -la reveals the permissions are my local user john.
Downgrading node to node 6.11.1 and npm 3.10.10 and node-sass installs globally first time without any issue, as does the npm package quilk which uses node-sass.
Without being one of the developers of node-sass or npm it is quite hard for me to be able to determine if this is an issue with npm or node-sass. So, i will be pointing the guys from npm to this issue.
Thanks,
John
npm runs scripts as a special user for security reasons.
```
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/node-sass/.node-gyp/8.1.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/node-sass/.node-gyp"
````
Since you're running npm scripts as root you'll need to use the --unsafe-perm flag. Also make sure you're running the latest npm@5 as there was a recent bug fix in this area.
@xzyfer
I just wiped node off my machine once again and forcefully removed the /user/lib/node_modules folder. Reinstalled 8 and the latest npm 5.3.0.
I then ran:
npm install -g --unsafe-perms node-sass
But i got the exact same results as before, the permissions loop.
We don't support installing node-sass globally. There are all kinds of permission issues. If you want it globally I recommend trying npx.
npx node-sass ....
npx comes packaged by default as part of [email protected]
I am not trying to install node-sass globally, but trying to install a package globally that uses node-sass.
Up until the latest npm release it always worked perfectly on linux/mac and windows
Same difference. Nothing regarding installations has changed in a while. I
suggest experimenting with previous node and/or npm versions to find the
culprit. Permission issues are very much out of our control.
On 19 Jul. 2017 1:53 am, "John" notifications@github.com wrote:
I am not trying to install node-sass globally, but trying to install a
package globally that uses node-sass.Up until the latest npm release it always worked perfectly on linux/mac
and windows—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/2045#issuecomment-316109100,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWLckzvpAgdiyMpz6p32x05hsvyTCks5sPNTfgaJpZM4ObBio
.
OK, shame.. as up until node8 it worked flawlessly. I emailed npm who said they will be following this thread.
As such, i noticed one thing. On my linux box running node 8, all the permissions for global packages were added with the permissions (where my user is john):
john:john
But on node < 8:
nobody:john
This is the only main difference i can see which is now breaking quilk on linux. I imagine if i added root to group john this would resolve the issue, but i don't understand why npm changed this. Surely this will break global packages installed on machines with multiple users too.... :/
@jdcrecur that would be something to raise with NPM
It's --unsafe-perm and not --unsafe-perms !
After one hour now it works...
Thanks @wibimaster, I've updated @xzyfer original comment about that, but left the other references since they represent people debugging with the wrong term.
Most helpful comment
It's --unsafe-perm and not --unsafe-perms !
After one hour now it works...