繁体   English   中英

Homebrew 安装 Node.js:找不到命令

[英]Homebrew install Node.js : Command Not Found

我有一台运行macOS 10.13.1的 Mac。 成功安装Homebrew后,我尝试安装Node.js

brew install node

安装似乎在终端中完成,但是要进行版本检查;

node -v

结果是

-bash: node: command not found

关于如何解决这个问题的任何指示?,我试图避免必须从二进制安装节点。

我遇到了这个问题,但这是因为我正在安装旧版本的节点。 对于较旧的版本,不会自动修改路径,以避免与可能安装的最新版本冲突。 运行brew install命令后,如果您要执行此操作,它应该为您提供有关如何将其添加到路径的说明。

尝试运行此命令

brew link node

brew doctor应该给你一些提示。

我刚刚为我的 Apple M1 进行了全新安装,似乎没有任何额外设置就可以正常工作。

$ 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM