-
Notifications
You must be signed in to change notification settings - Fork 3k
Error: Refusing to delete: /usr/local/bin/npm #3794
Comments
got same error |
same issue |
same here |
|
@isaacs Homebrew is a pretty popular package manager with many benefits and you should not ignore it. You can't advise people not to use it! Can you at least skip self-update under Homebrew? Nobody really cares if they are using the latest and greatest npm, but do care about other packages. |
Having npm be skipped on updates is not something we can do, as it would change an expected semantic of npm for a single package. This is confusing for users, and sends us (contributors and maintainers) down a path of unreasonable functionality/code maintenance. However, if this issue is major pain point for a lot of people, perhaps we can check with the homebrew folks if there's a way for them to handle the npm install differently. I'm not sure if this is possible with how and where homebrew installs things, but that doesn't mean it's not worth a try. Should there be a solution from this angle, it would be a long-term solution instead of a quick fix that will introduce technical debt. |
@luk- Now thinking about it, I have to agree with you - maybe fixing it in Homebrew would be best. Let me look into their "formula" and I will get back to you! |
@luk- Yes, they can definitely fix it on their end by changing a symlink. I will try submitting a patch. |
Homebrew dev here: if you want to submit an issue to us about this please clarify what the expected behaviour is, what the actual behaviour is and (ideally) submit a pull request with the actual fix. |
@MikeMcQuaid I will submit the patch tonight or tomorrow. I will provide all the required info. Thanks! |
2 months ago? What happened? |
News? I'm having this problem. |
me too... |
There isn't any news. If you want this fixed I suggest trying to write the patch yourself. |
It's a shame :( |
I had the same issue. Since there's still no fix I followed isaacs' advice and uninstalled the node and npm homebrew packages and used the nodejs.org installer. Working great now. |
@ryanburnett Yup, I did the same -- everything is good now :) |
If you do not want to uninstall node from brew. To workaround this issue, update symbolic link to npm as npm itself expects: Reference: Homebrew/legacy-homebrew#22408 |
Thanks @kvervo. It'd be lovely if npm worked with homebrew. God, I wish there was a universal package manager that dependably worked for every major platform such as this. |
sudo npm update -gf Interesting thing. I thought the |
-gf worked here as well. sudo shouldn't be necessary as I believe homebrew should be installed to work nicely without requiring it. |
Brew doesn't require sudo but npm occasionally does when it pukes. |
I confirm |
After forcing the overwrite by via the -gf switch, you can re-establish the links by calling: |
This issue simply makes me sad. |
@kud me too, I don't want to uninstall my node and npm with brew, no fix for this? |
For the moment, I do $ npm install -g --silent but ain't the best idea. :D |
My ultimate way to install node/npm with homebrew $ brew install node --without-npm
$ curl -L https://npmjs.org/install.sh | sh Please note sudo is NOT used anywhere in the above commands. The reason why I want to install node and npm separately is that homebrew does not like npm to update npm iteslf. homebrew has a philosophy that everything is inside it's Cellar. I personally appreeciate homebrew's clean way of doing things. However npm is just yet another package manager, which is not aware of homebrew's cellars philosophy. Therefore, I prefer to get homebrew to manager node, and let npm manage itself. |
Anyone having this issue with Snow Leopard, these are my steps to fix:
|
npm needs to work with homebrew. I should be able to run Node pretty much requires npm at this point. Telling people to not use homebrew for npm is ridiculous. Homebrew is used on a lot of production systems and ignoring it is a mistake. |
lol no. now unsubscribed |
@ripter you need to see this PR thread. |
@ripter the reason that I love homebrew is that homebrew helps to manage the upgrade of all my brewed software with a single command. Now npm can upgrade itself by
|
@chevex The issue is that
What happens if I need to pin the version of npm but I want to update the global packages for a production environment? |
@ripter Good luck getting very many people to agree that npm shouldn't update npm. That pull request already has a working solution that allows homebrew to install both node and npm, then let's npm update itself thereafter. It's fine now; go test out the fix for yourself. You're not going to convince the maintainers to stop npm from updating itself; that's a far more drastic change than manipulating the brew formula as has already been done. |
@chevex npm can update npm. That's fine. "This command will update all the packages listed to the latest version (specified by the tag config)." I understand that npm might see itself as a package. But that's not the expectation. This entire issue could be resolved by adding something like |
That doesn't really fix anything. It just makes it so npm breaks less often since it won't break with |
The issue is that npm tries to update itself when updating all global packages. aka |
As @MikeMcQuaid says in his own PR:
So no, leaving npm users to get frustrated when they try |
@chevex I never said to leave npm users frustrated when they try I'm saying This issue isn't just homebrew. This issue makes it impossible to update all global packages without updating npm. As it stands now, a production environment requires someone to manually add an |
If you install npm via homebrew with the old formula then trying to update npm via npm WILL break npm. Changing the behavior of npm will not fix this; the change has to happen in homebrew (even in your "fix" homebrew formula still has to change as well). I don't understand why you're arguing with me. There is already a working fix and it will be rolled into the production version of homebrew before you know it. This problem is solved, solution just has to ship. |
if The issue is that npm overloaded |
lol no. now unsubscribed as well |
Hahaha @chevex it was premeditated. ;) People who don't want to listen won't change their mind. |
This is (finally) fixed in Homebrew/legacy-homebrew@f900829. |
👍 |
@MikeMcQuaid you mean npm is no longer installed with |
No it is, just after the initial install npm is allowed to manage itself going forward. If you don't want it to install npm at all, still use |
@anthonybrown It's installed in the correct location using the npm tarball now. |
Just do this:
Then install from node website |
ln -s /Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm |
@adsr13 this appears to be completely unrelated to this issue. It is to do with the ember-cli tool, not npm. It can be ignored. It's telling you that they can't guarantee that ember-cli will work with Node v6.9.2. But if everything is going well, then you have nothing to worry about. Any further issues, please open a new Issue in the tracker! :) |
I installed Node via Homebrew after a reinstall of my OS. Trying to run
npm update -g
and getting the following error which I've never come across before.On Node v0.10.15 and npm v1.3.5.
The text was updated successfully, but these errors were encountered: