Showing posts with label mkdir 'node_modules/node-sass'. Show all posts
Showing posts with label mkdir 'node_modules/node-sass'. Show all posts

Tuesday, November 7, 2017

Error: EACCES: permission denied, mkdir 'node_modules/node-sass'



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:891: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:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)



You are trying these commands in project directory
sudo npm install node-sass
or
npm install node-sass
and it is giving above error and module is not getting installed.

Solution :

sudo chmod -R 777 projectfolder
Now it has sufficient permission to create files inside it. 
Do not use sudo with npm, it does not need root access to install package(module).
Now Run :
npm install node-sass
Now it will be installed. You can give correct permission to folder and files again, 777 is a security breach. We just made it for installing this module.