brew安装Nodejs遇到的问题

brew安装Nodejs遇到的问题

在M1芯片的Mac中安装Node.js与平时稍微有点不同,需要多加一行命令建立连接。

首先使用brew安装Node.js。

1
2
3
4
5
6
7
8
9
10
11
brew search node

==> Formulae
libbitcoin-node node-build node@12 nodebrew
llnode node-sass node@14 ✔ nodeenv
node node@10 node_exporter nodenv
==> Casks
nodebox nodeclipse

If you meant "node" specifically:
It was migrated from homebrew/cask to homebrew/core.
1
brew install node@14

安装完成后在终端执行Node返回

1
zsh: command not found: node

我们加一条命令给Node建立链接

1
2
3
4
5
6
brew link --overwrite --force node@14

Linking /opt/homebrew/Cellar/node@14/14.17.1... 3857 symlinks created.

If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/opt/homebrew/opt/node@14/bin:$PATH"' >> ~/.zshrc

看到下面这条返回结果,Node已经可以使用了。


brew安装Nodejs遇到的问题
https://ehum.github.io/2022/09/09/brew安装Nodejs遇到的问题/
作者
Ehum
发布于
2022年9月9日
许可协议