44

I am trying to install node using brew but it gets stuck at make install and does nothing. I am using ubunutu 14.04. Here is the logs from the terminal:

==> Downloading https://nodejs.org/dist/v4.2.1/node-v4.2.1.tar.gz
Already downloaded: /home/tsepak33/.cache/Homebrew/node-4.2.1.tar.gz
==> Downloading https://ssl.icu-project.org/files/icu4c/56.1/icu4c-56_1-src.tgz
Already downloaded: /home/tsepak33/.cache/Homebrew/node--icu4c-56.1.tgz
==> ./configure --prefix=/home/tsepak33/.linuxbrew/Cellar/node/4.2.1 --without-n
==> make install

I aso tried with brew reinstall node, but nothing works.

Vivek V Dwivedi
  • 2,510
  • 2
  • 28
  • 39
  • 1
    Brew on Linux?! What's wrong with apt-get? https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04 – Erk Aug 03 '18 at 02:09
  • At the time of posting, the node version used to be outdated in debian repos. Also, brew seemed like a good alternative to install node at that time. Looking by number of people interested, still seems to be a valid option. – Vivek V Dwivedi Aug 03 '18 at 10:15
  • Aha! Going from Linux to Mac myself, Brew has been a thorn in my eye. But you're right. It can be hard to get the latest versions with apt. And it can be even worse if you use beta repositories... – Erk Aug 04 '18 at 00:35

7 Answers7

99

I had the same problem. Eventually, I understood that I didn't wait enough time.

To prove that this is the problem, just run it with the -v switch

brew install -v node

The make install step takes about 20-25 minutes.

Itai Agmon
  • 1,417
  • 13
  • 12
  • 7
    I have no idea if this is normal, but the brew install took FOREVER. this is on a single core ubuntu 14.04. `/home/mike/.linuxbrew/Cellar/node@6/6.9.5: 3,890 files, 40.7M, built in 35 minutes 22 seconds` – 1mike12 Feb 24 '17 at 13:17
  • 2
    how long should you expect to wait? – Winnemucca Apr 21 '17 at 22:17
  • yep, adding -v shows the process output, so you know something is happening there and the process is not dead – Alfonso Sep 21 '17 at 13:23
  • 2
    The latest brew upgrade I did upgraded LLVM took 65 minutes on my 2-year old macbook pro (!). Make sure you give it time! – Matt Parkins Feb 12 '20 at 16:22
  • 1
    Same as @MattParkins, I have a 2017 Macbook pro with i7 16GB RAM with a fresh install of Sierra and a brand new brew install. It took node 46 mins to install. Gotta wait. – kenecaswell Apr 10 '20 at 05:18
  • thanks for the intel I am currently waiting. I think I'll give it an hour and a half at least based on what I've seen here. That's crazy the build time – Nick Schwaderer Nov 30 '20 at 14:41
  • 1
    Took me `195 minutes` on macOS 10.14.6 on a MBP 2,6 GHz Intel Core i5… – AvL Feb 22 '22 at 17:41
8

Looking at the OP's terminal logs, the OP installed node using the --without-npm option. According to the Homebrew FAQ, passing command-line options to the brew install command triggers a source build of the package, which can take a while to run.

I suspect the OP is passing --without-npm so that his global npm packages are properly migrated when upgrading Node with Homebrew without any wonky issues. I used to do the same, but since --without-npm turns out to slow down node installation, my new solution is to choose a separate directory for global npm packages. Set the following in your .bash_profile:

export NPM_CONFIG_PREFIX=/usr/local/lib/npm-packages
export PATH="$NPM_CONFIG_PREFIX"/bin:"$PATH"

To ensure that future node upgrades with Brew don't trigger source builds, uninstall node completely and then install it again.

brew uninstall --force node
brew install node

Because this is a clean reinstall of node, you'll need to reinstall your global npm packages.

caleb531
  • 4,111
  • 6
  • 31
  • 41
  • 2
    Even when I did a simple 'brew install node' it defaulted to include the '--without-npm' parameter. Homebrew FAQ says that this could happen if your OS environment isn't supported by the compiled binaries. – TheKarateKid Sep 29 '17 at 03:50
7

The reason is indeed that your OS is outdated and then brew can't install it and will do a make install which indeed takes time, no reason to blame that.

So this issue might be solved if you update your OS. I think most people are coming here with macOS and an unexpected outdated version. So update macOS and try again.

Marc
  • 2,659
  • 3
  • 34
  • 41
2

Answer #2 said, "So this issue might be solved if you update your OS. I think most people are coming here with macOS and an unexpected outdated version. So update macOS and try again."

Well there's an issue with that, why, because if your mac is a Mac Pro 3,1, the Highest MacOs you can install is 10.11.6, without any hacks etc. IN order to upgrade to a different macos, one will have to buy a newer mac like Mac Pro 4,1 and up in order to install anything higher than macos 10.11.6.

AMPLent
  • 21
  • 1
2

I had this problem on mac OSX 10.13.6 I first brew install node which took forever to finish. I had to cancel it. Tried the answer above after hours it returned llvm error. What solved my issue was going to nodejs website and downloading the app.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Limo
  • 21
  • 1
1

I had the same problem, the yarn installation with brew was taking longer than normal, I was waiting like more than 20 minutes.

Using npm install -g yarn worked like a charm for me, the installation was finished in like 5 seconds.

Caio Silva
  • 11
  • 3
0

As mentioned in the previous comment, this issue is likely caused by an outdated or unsupported macOS version. I encountered a similar problem, and manage to force update my MacBook Pro 2012 using the OpenCore Legacy Patcher. After the update, i've noticed a significant improvement in the installing process time compared to when i was using Catalina.