how resolve “sudo npm install” issues on MacOS The Next CEO of Stack OverflowHow to check for an active Internet connection on iOS or macOS?How does the vim “write with sudo” trick work?Where does npm install packages?How can I update NodeJS and NPM to the next versions?Find the version of an installed npm packageHow to uninstall npm modules in node js?npm throws error without sudoHow do I install pip on macOS or OS X?How to install an npm package from GitHub directly?What is the --save option for npm install?
Why don't programming languages automatically manage the synchronous/asynchronous problem?
Do I need to enable Dev Hub in my PROD Org?
I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin
What happened in Rome, when the western empire "fell"?
How to add tiny 0.5A 120V load to very remote split phase 240v 3 wire well house
Between two walls
What's the best way to handle refactoring a big file?
Is HostGator storing my password in plaintext?
Has this building technique been used in an official set?
How do I transpose the 1st and -1th levels of an arbitrarily nested array?
Should I tutor a student who I know has cheated on their homework?
Which tube will fit a -(700 x 25c) wheel?
If the heap is initialized for security, then why is the stack uninitialized?
calculus parametric curve length
What exact does MIB represent in SNMP? How is it different from OID?
What flight has the highest ratio of time difference to flight time?
If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?
Received an invoice from my ex-employer billing me for training; how to handle?
Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?
Why didn't Khan get resurrected in the Genesis Explosion?
Indicator light circuit
Why do we use the plural of movies in this phrase "We went to the movies last night."?
In excess I'm lethal
What does "Its cash flow is deeply negative" mean?
how resolve “sudo npm install” issues on MacOS
The Next CEO of Stack OverflowHow to check for an active Internet connection on iOS or macOS?How does the vim “write with sudo” trick work?Where does npm install packages?How can I update NodeJS and NPM to the next versions?Find the version of an installed npm packageHow to uninstall npm modules in node js?npm throws error without sudoHow do I install pip on macOS or OS X?How to install an npm package from GitHub directly?What is the --save option for npm install?
Some time ago i've tried to update npm using sudo npm install on my Mac,
so the update didn't work and now i can't Run any of my npm progects.
after this problem i tried to solve it search some answers on npm forum, and i've found a discussion where a developer said "never use sudo npm install, in particular on MacOS".
so my question is
- how can i fix this problem without Formatting my pc if possible
- why using sudo with npm command is a bad idea ?
I'm sorry for my bad english, but i try hard to do my best.
thanks for your patience.
node.js macos npm install sudo
add a comment |
Some time ago i've tried to update npm using sudo npm install on my Mac,
so the update didn't work and now i can't Run any of my npm progects.
after this problem i tried to solve it search some answers on npm forum, and i've found a discussion where a developer said "never use sudo npm install, in particular on MacOS".
so my question is
- how can i fix this problem without Formatting my pc if possible
- why using sudo with npm command is a bad idea ?
I'm sorry for my bad english, but i try hard to do my best.
thanks for your patience.
node.js macos npm install sudo
add a comment |
Some time ago i've tried to update npm using sudo npm install on my Mac,
so the update didn't work and now i can't Run any of my npm progects.
after this problem i tried to solve it search some answers on npm forum, and i've found a discussion where a developer said "never use sudo npm install, in particular on MacOS".
so my question is
- how can i fix this problem without Formatting my pc if possible
- why using sudo with npm command is a bad idea ?
I'm sorry for my bad english, but i try hard to do my best.
thanks for your patience.
node.js macos npm install sudo
Some time ago i've tried to update npm using sudo npm install on my Mac,
so the update didn't work and now i can't Run any of my npm progects.
after this problem i tried to solve it search some answers on npm forum, and i've found a discussion where a developer said "never use sudo npm install, in particular on MacOS".
so my question is
- how can i fix this problem without Formatting my pc if possible
- why using sudo with npm command is a bad idea ?
I'm sorry for my bad english, but i try hard to do my best.
thanks for your patience.
node.js macos npm install sudo
node.js macos npm install sudo
asked Mar 7 at 15:21
BistoXBistoX
132
132
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I wrote an article about this issue that also walks through some solutions to managing node/npm versions without using sudo: https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92
I'll try to summarize here.
First of all, if you're using MacOS, I highly recommend using homebrew to install system node if you haven't done so already. You should be able to run brew install node (which will also install npm and yarn) without using sudo assuming you've gone through the homebrew setup properly.
If you want to manage multiple versions of Node, I highly recommend https://github.com/tj/n as a tool. nvm is also very popular, but I prefer n. I walk through how to install and manage n in my article, but someone has also created a tool to help you through this: https://github.com/mklement0/n-install.
You can also take a look at this part of my 2015 article on the same topic to potentially help you with issues you might face from having run sudo npm install in the past. You might try sudo rm -rf node_modules in your project followed by npm install (without sudo).
Similarly, you may have to do something akin to sudo rm -rf $(npm prefix -g)/bin,lib/node_modules in case you globally installed node modules with the wrong prefix. Just be aware that this will remove libraries you installed with sudo before, so you will have to install them again.
In addition to the issues you're running into, a key reason why you shouldn't use sudo npm anything is because npm commands including install have the ability to run arbitrary scripts including ones that are downloaded from the registry. You don't want to give root permissions to something that runs arbitrary scripts!
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047241%2fhow-resolve-sudo-npm-install-issues-on-macos%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I wrote an article about this issue that also walks through some solutions to managing node/npm versions without using sudo: https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92
I'll try to summarize here.
First of all, if you're using MacOS, I highly recommend using homebrew to install system node if you haven't done so already. You should be able to run brew install node (which will also install npm and yarn) without using sudo assuming you've gone through the homebrew setup properly.
If you want to manage multiple versions of Node, I highly recommend https://github.com/tj/n as a tool. nvm is also very popular, but I prefer n. I walk through how to install and manage n in my article, but someone has also created a tool to help you through this: https://github.com/mklement0/n-install.
You can also take a look at this part of my 2015 article on the same topic to potentially help you with issues you might face from having run sudo npm install in the past. You might try sudo rm -rf node_modules in your project followed by npm install (without sudo).
Similarly, you may have to do something akin to sudo rm -rf $(npm prefix -g)/bin,lib/node_modules in case you globally installed node modules with the wrong prefix. Just be aware that this will remove libraries you installed with sudo before, so you will have to install them again.
In addition to the issues you're running into, a key reason why you shouldn't use sudo npm anything is because npm commands including install have the ability to run arbitrary scripts including ones that are downloaded from the registry. You don't want to give root permissions to something that runs arbitrary scripts!
add a comment |
I wrote an article about this issue that also walks through some solutions to managing node/npm versions without using sudo: https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92
I'll try to summarize here.
First of all, if you're using MacOS, I highly recommend using homebrew to install system node if you haven't done so already. You should be able to run brew install node (which will also install npm and yarn) without using sudo assuming you've gone through the homebrew setup properly.
If you want to manage multiple versions of Node, I highly recommend https://github.com/tj/n as a tool. nvm is also very popular, but I prefer n. I walk through how to install and manage n in my article, but someone has also created a tool to help you through this: https://github.com/mklement0/n-install.
You can also take a look at this part of my 2015 article on the same topic to potentially help you with issues you might face from having run sudo npm install in the past. You might try sudo rm -rf node_modules in your project followed by npm install (without sudo).
Similarly, you may have to do something akin to sudo rm -rf $(npm prefix -g)/bin,lib/node_modules in case you globally installed node modules with the wrong prefix. Just be aware that this will remove libraries you installed with sudo before, so you will have to install them again.
In addition to the issues you're running into, a key reason why you shouldn't use sudo npm anything is because npm commands including install have the ability to run arbitrary scripts including ones that are downloaded from the registry. You don't want to give root permissions to something that runs arbitrary scripts!
add a comment |
I wrote an article about this issue that also walks through some solutions to managing node/npm versions without using sudo: https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92
I'll try to summarize here.
First of all, if you're using MacOS, I highly recommend using homebrew to install system node if you haven't done so already. You should be able to run brew install node (which will also install npm and yarn) without using sudo assuming you've gone through the homebrew setup properly.
If you want to manage multiple versions of Node, I highly recommend https://github.com/tj/n as a tool. nvm is also very popular, but I prefer n. I walk through how to install and manage n in my article, but someone has also created a tool to help you through this: https://github.com/mklement0/n-install.
You can also take a look at this part of my 2015 article on the same topic to potentially help you with issues you might face from having run sudo npm install in the past. You might try sudo rm -rf node_modules in your project followed by npm install (without sudo).
Similarly, you may have to do something akin to sudo rm -rf $(npm prefix -g)/bin,lib/node_modules in case you globally installed node modules with the wrong prefix. Just be aware that this will remove libraries you installed with sudo before, so you will have to install them again.
In addition to the issues you're running into, a key reason why you shouldn't use sudo npm anything is because npm commands including install have the ability to run arbitrary scripts including ones that are downloaded from the registry. You don't want to give root permissions to something that runs arbitrary scripts!
I wrote an article about this issue that also walks through some solutions to managing node/npm versions without using sudo: https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92
I'll try to summarize here.
First of all, if you're using MacOS, I highly recommend using homebrew to install system node if you haven't done so already. You should be able to run brew install node (which will also install npm and yarn) without using sudo assuming you've gone through the homebrew setup properly.
If you want to manage multiple versions of Node, I highly recommend https://github.com/tj/n as a tool. nvm is also very popular, but I prefer n. I walk through how to install and manage n in my article, but someone has also created a tool to help you through this: https://github.com/mklement0/n-install.
You can also take a look at this part of my 2015 article on the same topic to potentially help you with issues you might face from having run sudo npm install in the past. You might try sudo rm -rf node_modules in your project followed by npm install (without sudo).
Similarly, you may have to do something akin to sudo rm -rf $(npm prefix -g)/bin,lib/node_modules in case you globally installed node modules with the wrong prefix. Just be aware that this will remove libraries you installed with sudo before, so you will have to install them again.
In addition to the issues you're running into, a key reason why you shouldn't use sudo npm anything is because npm commands including install have the ability to run arbitrary scripts including ones that are downloaded from the registry. You don't want to give root permissions to something that runs arbitrary scripts!
answered Mar 7 at 15:29
Explosion PillsExplosion Pills
151k38228317
151k38228317
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047241%2fhow-resolve-sudo-npm-install-issues-on-macos%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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