How do I resolve gyp ERR! stack Error: EACCES: permission denied, mkdir …node_modules when I am using sudo...












0















Before my last pull I was able to install npm packages with sudo npm install



The last package I installed was dotenv. I can't imagine that would cause this problem but I can't say for sure.



but now I am getting the EACCES error even if I use root.



I removed the entire directory and cloned again with no luck.



server: digitaloceal Ubuntu 16.04



deployment method: Git



ERROR MESSAGES



USER@uhr:/var/www/mysite$ sudo npm install

> buffertools@2.1.6 install /var/www/mysite/node_modules/buffertools
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/mysite/node_modules/buffertools/build'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/mysite/node_modules/buffertools
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

> node-expat@2.3.17 install /var/www/mysite/node_modules/node-expat
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/mysite/node_modules/node-expat/build'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/mysite/node_modules/node-expat
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN mysite@1.0.0 No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: buffertools@2.1.6 (node_modules/buffertools):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: buffertools@2.1.6 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.17 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/USER/.npm/_logs/2018-11-23T17_51_52_704Z-debug.log


package.json



    {
"name": "MYSITE",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"async": "^2.6.1",
"bcrypt": "^3.0.2",
"bcryptjs": "^2.4.3",
"bluebird": "^3.5.3",
"body-parser": "^1.18.3",
"cors": "^2.8.4",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"jsonwebtoken": "latest",
"lodash": "^4.17.11",
"mongoose": "^5.3.7",
"nodemailer": "^4.6.8",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"request": "^2.88.0",
"rets-client": "^5.2.3",
"socket.io": "^2.1.1",
"through2": "^3.0.0",
"underscore": "^1.9.1"
},
"devDependencies": {},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"repository": {
"type": "git",
"url": "MYREPO"
},
"author": "",
"license": "UNLICENSED",
"bugs": {
"url": "MYREPO"
},
"homepage": "MYREPO"
}









share|improve this question




















  • 1





    Probably not what you want to hear, but don't use sudo. See here: stackoverflow.com/questions/16151018/…

    – James Hibbard
    Nov 25 '18 at 10:06











  • It's exactly what I needed to hear... This fixed it. Thank You.

    – user4683497
    Nov 25 '18 at 17:45











  • Oh cool. Glad you got it sorted.

    – James Hibbard
    Nov 26 '18 at 12:00
















0















Before my last pull I was able to install npm packages with sudo npm install



The last package I installed was dotenv. I can't imagine that would cause this problem but I can't say for sure.



but now I am getting the EACCES error even if I use root.



I removed the entire directory and cloned again with no luck.



server: digitaloceal Ubuntu 16.04



deployment method: Git



ERROR MESSAGES



USER@uhr:/var/www/mysite$ sudo npm install

> buffertools@2.1.6 install /var/www/mysite/node_modules/buffertools
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/mysite/node_modules/buffertools/build'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/mysite/node_modules/buffertools
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

> node-expat@2.3.17 install /var/www/mysite/node_modules/node-expat
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/mysite/node_modules/node-expat/build'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/mysite/node_modules/node-expat
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN mysite@1.0.0 No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: buffertools@2.1.6 (node_modules/buffertools):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: buffertools@2.1.6 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.17 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/USER/.npm/_logs/2018-11-23T17_51_52_704Z-debug.log


package.json



    {
"name": "MYSITE",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"async": "^2.6.1",
"bcrypt": "^3.0.2",
"bcryptjs": "^2.4.3",
"bluebird": "^3.5.3",
"body-parser": "^1.18.3",
"cors": "^2.8.4",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"jsonwebtoken": "latest",
"lodash": "^4.17.11",
"mongoose": "^5.3.7",
"nodemailer": "^4.6.8",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"request": "^2.88.0",
"rets-client": "^5.2.3",
"socket.io": "^2.1.1",
"through2": "^3.0.0",
"underscore": "^1.9.1"
},
"devDependencies": {},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"repository": {
"type": "git",
"url": "MYREPO"
},
"author": "",
"license": "UNLICENSED",
"bugs": {
"url": "MYREPO"
},
"homepage": "MYREPO"
}









share|improve this question




















  • 1





    Probably not what you want to hear, but don't use sudo. See here: stackoverflow.com/questions/16151018/…

    – James Hibbard
    Nov 25 '18 at 10:06











  • It's exactly what I needed to hear... This fixed it. Thank You.

    – user4683497
    Nov 25 '18 at 17:45











  • Oh cool. Glad you got it sorted.

    – James Hibbard
    Nov 26 '18 at 12:00














0












0








0








Before my last pull I was able to install npm packages with sudo npm install



The last package I installed was dotenv. I can't imagine that would cause this problem but I can't say for sure.



but now I am getting the EACCES error even if I use root.



I removed the entire directory and cloned again with no luck.



server: digitaloceal Ubuntu 16.04



deployment method: Git



ERROR MESSAGES



USER@uhr:/var/www/mysite$ sudo npm install

> buffertools@2.1.6 install /var/www/mysite/node_modules/buffertools
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/mysite/node_modules/buffertools/build'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/mysite/node_modules/buffertools
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

> node-expat@2.3.17 install /var/www/mysite/node_modules/node-expat
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/mysite/node_modules/node-expat/build'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/mysite/node_modules/node-expat
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN mysite@1.0.0 No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: buffertools@2.1.6 (node_modules/buffertools):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: buffertools@2.1.6 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.17 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/USER/.npm/_logs/2018-11-23T17_51_52_704Z-debug.log


package.json



    {
"name": "MYSITE",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"async": "^2.6.1",
"bcrypt": "^3.0.2",
"bcryptjs": "^2.4.3",
"bluebird": "^3.5.3",
"body-parser": "^1.18.3",
"cors": "^2.8.4",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"jsonwebtoken": "latest",
"lodash": "^4.17.11",
"mongoose": "^5.3.7",
"nodemailer": "^4.6.8",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"request": "^2.88.0",
"rets-client": "^5.2.3",
"socket.io": "^2.1.1",
"through2": "^3.0.0",
"underscore": "^1.9.1"
},
"devDependencies": {},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"repository": {
"type": "git",
"url": "MYREPO"
},
"author": "",
"license": "UNLICENSED",
"bugs": {
"url": "MYREPO"
},
"homepage": "MYREPO"
}









share|improve this question
















Before my last pull I was able to install npm packages with sudo npm install



The last package I installed was dotenv. I can't imagine that would cause this problem but I can't say for sure.



but now I am getting the EACCES error even if I use root.



I removed the entire directory and cloned again with no luck.



server: digitaloceal Ubuntu 16.04



deployment method: Git



ERROR MESSAGES



USER@uhr:/var/www/mysite$ sudo npm install

> buffertools@2.1.6 install /var/www/mysite/node_modules/buffertools
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/mysite/node_modules/buffertools/build'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/mysite/node_modules/buffertools
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

> node-expat@2.3.17 install /var/www/mysite/node_modules/node-expat
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/mysite/node_modules/node-expat/build'
gyp ERR! System Linux 4.4.0-139-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/mysite/node_modules/node-expat
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN mysite@1.0.0 No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: buffertools@2.1.6 (node_modules/buffertools):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: buffertools@2.1.6 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.17 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/USER/.npm/_logs/2018-11-23T17_51_52_704Z-debug.log


package.json



    {
"name": "MYSITE",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"async": "^2.6.1",
"bcrypt": "^3.0.2",
"bcryptjs": "^2.4.3",
"bluebird": "^3.5.3",
"body-parser": "^1.18.3",
"cors": "^2.8.4",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"jsonwebtoken": "latest",
"lodash": "^4.17.11",
"mongoose": "^5.3.7",
"nodemailer": "^4.6.8",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"request": "^2.88.0",
"rets-client": "^5.2.3",
"socket.io": "^2.1.1",
"through2": "^3.0.0",
"underscore": "^1.9.1"
},
"devDependencies": {},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"repository": {
"type": "git",
"url": "MYREPO"
},
"author": "",
"license": "UNLICENSED",
"bugs": {
"url": "MYREPO"
},
"homepage": "MYREPO"
}






node.js linux ubuntu npm digital-ocean






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 20:58

























asked Nov 23 '18 at 18:11







user4683497















  • 1





    Probably not what you want to hear, but don't use sudo. See here: stackoverflow.com/questions/16151018/…

    – James Hibbard
    Nov 25 '18 at 10:06











  • It's exactly what I needed to hear... This fixed it. Thank You.

    – user4683497
    Nov 25 '18 at 17:45











  • Oh cool. Glad you got it sorted.

    – James Hibbard
    Nov 26 '18 at 12:00














  • 1





    Probably not what you want to hear, but don't use sudo. See here: stackoverflow.com/questions/16151018/…

    – James Hibbard
    Nov 25 '18 at 10:06











  • It's exactly what I needed to hear... This fixed it. Thank You.

    – user4683497
    Nov 25 '18 at 17:45











  • Oh cool. Glad you got it sorted.

    – James Hibbard
    Nov 26 '18 at 12:00








1




1





Probably not what you want to hear, but don't use sudo. See here: stackoverflow.com/questions/16151018/…

– James Hibbard
Nov 25 '18 at 10:06





Probably not what you want to hear, but don't use sudo. See here: stackoverflow.com/questions/16151018/…

– James Hibbard
Nov 25 '18 at 10:06













It's exactly what I needed to hear... This fixed it. Thank You.

– user4683497
Nov 25 '18 at 17:45





It's exactly what I needed to hear... This fixed it. Thank You.

– user4683497
Nov 25 '18 at 17:45













Oh cool. Glad you got it sorted.

– James Hibbard
Nov 26 '18 at 12:00





Oh cool. Glad you got it sorted.

– James Hibbard
Nov 26 '18 at 12:00












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451296%2fhow-do-i-resolve-gyp-err-stack-error-eacces-permission-denied-mkdir-node%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451296%2fhow-do-i-resolve-gyp-err-stack-error-eacces-permission-denied-mkdir-node%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ottavio Pratesi

Tricia Helfer

15 giugno