fitzmode
fitzmode

Reputation: 1066

Homebrew install Node.js : Command Not Found

I have a Mac running macOS 10.13.1. After installing Homebrew successfully, I tried to intall Node.js with

brew install node

The installation seems to complete fine in the terminal, however following up with a version check ;

node -v

results in

-bash: node: command not found

Any pointers on how to fix this ?, I am trying to avoid to have to install node from binary.

Upvotes: 10

Views: 9309

Answers (3)

chenrui
chenrui

Reputation: 9868

brew doctor should give you some hints.

I just did a fresh installation for my Apple M1, seems just working fine without any additional setup.

$ brew install node
==> Downloading https://ghcr.io/v2/homebrew/core/c-ares/manifests/1.18.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/c-ares/blobs/sha256:7b1eacc9efbe8ac32a4a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:7b1e
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libuv/manifests/1.42.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libuv/blobs/sha256:7b0a2b27ac3b806ff9e59
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:7b0a
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/node/manifests/17.2.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/node/blobs/sha256:f3efe9900c885d5bcc3a39
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:f3ef
######################################################################## 100.0%
==> Installing dependencies for node: c-ares and libuv
==> Installing node dependency: c-ares
==> Pouring c-ares--1.18.1.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/c-ares/1.18.1: 87 files, 665.3KB
==> Installing node dependency: libuv
==> Pouring libuv--1.42.0.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libuv/1.42.0: 49 files, 3.5MB
==> Installing node
==> Pouring node--17.2.0.arm64_monterey.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /opt/homebrew/etc/bash_completion.d
==> Summary
🍺  /opt/homebrew/Cellar/node/17.2.0: 2,018 files, 44.4MB
==> Running `brew cleanup node`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> node
Bash completion has been installed to:
  /opt/homebrew/etc/bash_completion.d

$ ls -al /opt/homebrew/bin/node
lrwxr-xr-x  1 ruichen  admin  30 Dec 13 15:56 /opt/homebrew/bin/node -> ../Cellar/node/17.2.0/bin/node

$ node --version
v17.2.0

Upvotes: 0

Soufyane GRINI
Soufyane GRINI

Reputation: 76

try running this command

brew link node

Upvotes: 6

katmfoo
katmfoo

Reputation: 96

I was having this issue but it was because I was installing an older version of node. For older versions, the path isn't modified automatically to avoid colliding with the potentially installed up to date version. After running the brew install command, it should give you instructions on how to add it to your path if thats what you want to do.

Upvotes: 5

Related Questions