Javascript 如何 brew 安装特定版本的 Node?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44803721/
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 brew install specific version of Node?
提问by Leon Gaban
For example I want to install either 7.9 or 7.10 but want to avoid Node 8 due to the webpack node-sassbreaking bug.
例如,我想安装 7.9 或 7.10,但由于webpack node-sass破坏性错误,我想避免使用 Node 8 。
When I run brew search nodethis is what I see:
当我运行时,brew search node这是我看到的:
? brew search node leafnode llnode node ? node-build > [email protected] [email protected] node@4 node@6 nodebrew nodeenv nodenv caskroom/cask/node-profiler
If you meant "node" specifically: It was migrated from caskroom/cask to homebrew/core. You can access it again by running: brew tap homebrew/core
? 酿造搜索节点leafnode llnode 节点?node-build > [email protected] [email protected] node@4 node@6 nodebrew nodeenv nodeenv caskroom/cask/node-profiler
如果您特别指的是“节点”:它是从 caskroom/cask 迁移到 homebrew/core 的。您可以通过运行再次访问它: brew tap homebrew/core
There is node which is checked (my current version is v7.4.0then [email protected], [email protected], node@4and node@6?
存在被检查的节点(我目前的版本是v7.4.0,然后[email protected],[email protected],node@4和node@6?
The reason I can't just fully upgrade to 8 is node-sass won't work in webpack.
我不能完全升级到 8 的原因是 node-sass 在 webpack 中不起作用。
Just installed NVM and got this crazy error log:
刚刚安装了 NVM 并得到了这个疯狂的错误日志:
=> nvm source string already in /Users/leongaban/.zshrc
=> Appending bash_completion source string to /Users/leongaban/.zshrc
npm ERR! missing: is-path-cwd@^1.0.0, required by [email protected]
npm ERR! missing: is-path-in-cwd@^1.0.0, required by [email protected]
npm ERR! missing: p-map@^1.1.1, required by [email protected]
npm ERR! missing: pify@^3.0.0, required by [email protected]
npm ERR! missing: rimraf@^2.2.8, required by [email protected]
npm ERR! missing: bluebird@^3.1.1, required by [email protected]
npm ERR! missing: clone@^1.0.2, required by [email protected]
=> nvm source string already in /Users/leongaban/.zshrc
=> Appending bash_completion source string to /Users/leongaban/.zshrc
npm ERR! missing: is-path-cwd@^1.0.0, required by [email protected]
npm ERR! missing: is-path-in-cwd@^1.0.0, required by [email protected]
npm ERR! missing: p-map@^1.1.1, required by [email protected]
npm ERR! missing: pify@^3.0.0, required by [email protected]
npm ERR! missing: rimraf@^2.2.8, required by [email protected]
npm ERR! missing: bluebird@^3.1.1, required by [email protected]
npm ERR! missing: clone@^1.0.2, required by [email protected]
...
...
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:
If I'm reading this right, does this mean I can't use npmto globally install packages anymore and have to use nvm?
如果我没看错,这是否意味着我不能再使用npm全局安装包而必须使用nvm?
Update
更新
I added the export lines to my .zshrcbash (I don't use bash_profile)
我将导出行添加到我的.zshrcbash(我不使用 bash_profile)
? nvm --version
0.33.2
采纳答案by balintant
If versions on homebrew/codeare defined right, you must also be able to brew install [email protected]for example.
如果版本homebrew/code定义正确,您还必须能够brew install [email protected]例如。
You can also install multiple versions and select which one you want to use with the brew switchcommand.
您还可以安装多个版本并通过brew switch命令选择要使用的版本。
--
——
Anyway, I'd recommend using nvm, which can be installed through Homebrew. Although, the version on brewis buggy and they don't plan fixing it.
无论如何,我建议使用nvm,它可以通过 Homebrew 安装。虽然,该版本brew有问题,他们不打算修复它。

