如何通过自制软件安装 LTS 版本的 nodejs
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40000509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install LTS version of nodejs via homebrew
提问by user3448600
When I run brew install nodeit install v6.7.0 Currentbut I want LTSversion which is at the time of this writing v4.6.0 LTS. Which commands I need to issue to install LTSversion of Node via Homebrew.
当我运行brew install node它时安装v6.7.0 Current但我想要在撰写本文时的LTS版本v4.6.0 LTS。我需要发出哪些命令才能通过 Homebrew安装LTS版本的 Node。
回答by Iryston
You can use
brew install node@4, brew install node@6, or brew install node@8command to install LTS version of Node via Homebrew.
您可以使用
brew install node@4、brew install node@6或brew install node@8命令通过 Homebrew 安装 LTS 版本的 Node。
If another version of Node is already installed, you should uninstall it first to avoid conflicts.
如果已经安装了另一个版本的 Node,你应该先卸载它以避免冲突。
Also note that LTS versions of node (e.g. node@10) are keg-only and must either be linked with --force (brew link --force node@10) or you need to add the binary to your path by running:
另请注意,节点的 LTS 版本(例如 node@10)仅用于桶,并且必须与 --force ( brew link --force node@10)链接,或者您需要通过运行将二进制文件添加到您的路径中:
echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bashrc
回答by Ankit
You can always look up LTS and stable versions from node releases page and also look at homebrew formulae here.
It shows how u can install stable version vs other versions.
For example right now, brew install node@10will install LTS version 10.16.
您可以随时从节点发布页面查找 LTS 和稳定版本,也可以在此处查看自制程序公式。
它显示了如何安装稳定版本与其他版本。例如现在,brew install node@10将安装 LTS 版本 10.16。

