使用Homebrew将Node v8和v14安装在一台计算机上 [英] Install Node v8 and v14 in one machine using Homebrew
问题描述
我正在使用 macOS Catalina 10.15.5 ,自制软件2.4.12 ,现在我已经安装了 Node v14.8.0 和Nvm 0.35.3 .
I am using macOS Catalina 10.15.5, Homebrew 2.4.12 and now I have installed Node v14.8.0 and Nvm 0.35.3.
所有这些都是由 Homebrew 安装的( node
和 nvm
已安装公式).
all of this was installed by Homebrew (node
and nvm
are installed formulae).
我的目标是:
- 安装 Node 的版本8,而不卸载现有的版本
- 具有轻松切换版本(8和14)的功能
- install version 8 of Node without uninstalling the existing one
- have ability to switch between versions easily (8 and 14)
就像我前一段时间看到的那样,在 Homebrew 存储库中,有可用的公式 node @ 8
,但现在没有.
As I saw some time ago, in Homebrew repository there was available formula node@8
, but now it isn't.
我应该点击其他回购来查看 node @ 8
公式吗?如果完全无法进行Brew,可以使用 nvm
公式来管理版本吗?如果是-预期当我运行 nvm list
时,结果是:
Should I tap additional repo to check out node@8
formula?
If it is totally unavailable for brew, is it ok to use nvm
formula to manage versions? if yes - is it expected that when I run nvm list
the result is:
-> system
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
?
版本为 N/A
当我运行 node --version
时,我会看到 v14.8.0
where version is N/A
and when I run node --version
I see v14.8.0
使用 Homebrew 达到我的目标的正确方法是什么?
what is proper way to reach my goal using Homebrew?
推荐答案
tl;dr - Uninstall the homebrew version, use nvm. Don't use homebrew to install node... ever.
几年前,我同时使用homebrew和nvm来安装节点,因为我对应该尽可能使用homebrew的想法有很多看法(很多文章推荐它,它在mac社区中得到了广泛采用,我使用它来进行安装许多其他软件).使用错误版本的节点,我经常遇到某些终端/任务/脚本/等问题.别像我-自制软件只是一个工具...一个很棒的工具...但是在安装单个软件的多个版本以及允许在版本之间轻松切换时并不是很好.NVM非常擅长于此.使用工具完成工作.
I used both homebrew and nvm to install node years ago because I had some attachment to the idea that homebrew should be used whenever possible (a lot of articles recommend it, it's highly adopted in the mac community, I used it for installing lots of other software). I constantly had issues with certain terminals/tasks/scripts/etc using the wrong version of node. Don't be like me - homebrew is just a tool... a great tool... but it's not very good at installing multiple versions of a single piece of software and allowing easy switching between versions. NVM is very good at that. Use the tool for the job.
这篇关于使用Homebrew将Node v8和v14安装在一台计算机上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!