Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

node: install npm using tarball. #28075

Closed
wants to merge 1 commit into from
Closed

node: install npm using tarball. #28075

wants to merge 1 commit into from

Conversation

MikeMcQuaid
Copy link
Member

Install npm to the expected location using the upstream tarball. This should make everyone happier.

This means Homebrew doesn't really manage npm any more but does install it. This is treated similarly to how we handle pip and means that npm can upgrade itself.

Closes #27479.

@chevcast
Copy link

chevcast commented Apr 2, 2014

Yes! This is the ideal solution I originally wanted. I'll be testing this for sure.

Install npm to the expected location using the upstream tarball. This
should make everyone happier.

Closes #27479.
@MikeMcQuaid
Copy link
Member Author

Ping @jacknagel @adamv @mistydemeo @asparagui for any objections.

@ebsen
Copy link

ebsen commented Apr 3, 2014

Apologies in advance for the noob question, but what needs done to make sure we've reached this setup in order to test?

I uninstalled npm (with npm uninstall npm -g) and node (with brew uninstall node, brew cleanup), reinstalled node (with a brew update, brew install node) and I'm still seeing the refusal to delete /usr/local/bin/npm.

I'm on Homebrew 43b7f5b.

@MikeMcQuaid
Copy link
Member Author

git reset --hard origin/master
brew uninstall node
rm -rf $(brew --prefix)/lib/node_modules
brew pull 28075
brew install node --with-npm
npm update -g

@chevcast
Copy link

chevcast commented Apr 3, 2014

I followed your instructions to test the formula and so far so good, no issues.

I should mention that nothing breaks if npm update -g didn't actually have any updates for npm itself. I tried running npm install [email protected] which appeared to succeed, but when I then ran npm -v the version was still 1.4.6. Maybe npm can't downgrade itself? I'll keep doing npm updates with this new install for a while, hopefully I'll see an update come through successfully.

@MikeMcQuaid
Copy link
Member Author

You can manually downgrade the URL in the formula to 1.4.5 and you'll see it upgrades to 1.4.6 on installation.

@MikeMcQuaid
Copy link
Member Author

Gonna pull this relatively shortly if there are no problems/objections.

@chevcast
Copy link

chevcast commented Apr 3, 2014

Didn't think to do that. Thanks for the tip.

Edit: Confirmed! For the first time in a year I think node and npm are working as expected after installing from brew :D

Thanks for all your work on this. I can't express how appreciative my team and I are; makes things much simpler for us.

@ebsen
Copy link

ebsen commented Apr 4, 2014

Beautiful. Thanks for the additional instruction, @MikeMcQuaid. I would not have been able to pull that off otherwise.

@MikeMcQuaid
Copy link
Member Author

Merged in f900829.

@MikeMcQuaid MikeMcQuaid closed this Apr 4, 2014
@MikeMcQuaid MikeMcQuaid deleted the npm branch April 4, 2014 10:58
@rayshan
Copy link

rayshan commented Apr 5, 2014

Hi @MikeMcQuaid, is there a way to get on this formula without rm -rf $(brew --prefix)/lib/node_modules? I assume that'll remove all currently globally installed modules. Deleting and reinstalling npm isn't that bad, but reinstalling all is quite a bit to ask.

@mgol
Copy link

mgol commented Apr 5, 2014

@rayshan

npm -g ls 2>/dev/null | grep '^[└├]' | grep -v npm | cut -f2- -d" " | cut -f1 -d@ | tr '\n' ' '

And you get a list to copy & later to paste to npm -g install. Easy-peasy.

@rayshan
Copy link

rayshan commented Apr 5, 2014

Cool that works, thanks @mzgol

@cvn
Copy link

cvn commented Apr 9, 2014

Thanks @MikeMcQuaid!

mathiasbynens added a commit to mathiasbynens/dotfiles that referenced this pull request May 13, 2014
ifdattic pushed a commit to ifdattic/dotfiles-old that referenced this pull request Jun 23, 2014
alrra added a commit to alrra/dotfiles that referenced this pull request Jun 29, 2014
Now that the `npm` related issue (see: Homebrew/legacy-homebrew#27479) has been
fixed (see: Homebrew/legacy-homebrew#28075), revert back to using `Homebrew` to
install `Node.js` and `npm` on OS X.
thorsten pushed a commit to thorsten/dotfiles that referenced this pull request Dec 12, 2014
@DomT4 DomT4 mentioned this pull request Jan 14, 2015
Krettis pushed a commit to Krettis/dotfiles that referenced this pull request Mar 25, 2015
natchiketa pushed a commit to natchiketa/dotfiles that referenced this pull request Jun 25, 2015
@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants