Fix NPM Error : Permission denied, mkdir related to node-sass (macOS)

npm error related to node-sass fix Mac

I was using two development environment. For VueJS with Webpack Simple including Sass and VueJS with full webpack so after working with the previous when I wanted to develop the later project, I started getting an error after I did sudo npm install which was specifically related to node-sass throwing the error that permission denied for creating a new folder.


gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/Users/ node_modules/node-sass/build’

I spent two hours trying to figure out everything, reinstalling, emptying node cache and everything but to no avail until I understood that this confliction was actually because I was running two versions of nodeJS and one of them one globally installed and found out that sass has a problem adapting to a new version. So, just execute the below command and Voila!.

If the problem persists please post a comment and I will help you out.


<code>rm -rf node_modules && npm rebuild node-sass && npm i</code>

Hope this helps.


Please enter your comment!
Please enter your name here