Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Ubuntu or Linux error: Error: EACCES: permission denied, mkdir ‘/opt/lampp/htdocs/node_modules/node-sass/vendor’

How I got this error:
I got this error while running command: npm install in one of my project directory located at /opt/lamoo/htdocs

What was the Error:

root@ip-ip-address:/opt/lampp/htdocs/[projectName]# npm install

] node-sass@4.13.1 install /opt/lampp/htdocs/[projectName]/node_modules/node-sass
] node scripts/install.js

Unable to save binary /opt/lampp/htdocs/[projectName]/node_modules/node-sass/vendor/linux-x64-72 : Error: EACCES: permission denied, mkdir '/opt/lampp/htdocs/[projectName]/node_modules/node-sass/vendor'
at Object.mkdirSync (fs.js:823:3)
at sync (/opt/lampp/htdocs/[projectName]/node_modules/mkdirp/index.js:71:13)
at Function.sync (/opt/lampp/htdocs/[projectName]/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/opt/lampp/htdocs/[projectName]/node_modules/node-sass/scripts/install.js:114:11)
at Object.anonymous
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) {
errno: -13,
syscall: 'mkdir',
code: 'EACCES',
path: '/opt/lampp/htdocs/[projectName]/node_modules/node-sass/vendor'
}

Solution:
Run sudo npm install

Thanks for reading, I hope you enjoyed the article.

Chetan