bash 如何通过 Mac 上的终端更新 node.js 和 CoffeeScript 版本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8805647/
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 update node.js and CoffeeScript version via terminal on mac?
提问by MMA
My system node.js version is v0.6.1 but the current stable version is v0.6.7. My system CoffeeScript version is v1.1.2 but the current stable version is v1.2.0
我的系统 node.js 版本是 v0.6.1,但当前稳定版本是 v0.6.7。我的系统 CoffeeScript 版本是 v1.1.2 但目前稳定版本是 v1.2.0
How could I update the node.js and CoffeeScript via terminal on mac( using mac )? I am pretty good with command line but I do need some help get started to update those applications. Thank you very much for helps.
我如何通过 mac 上的终端更新 node.js 和 CoffeeScript(使用 mac )?我很擅长命令行,但我确实需要一些帮助才能开始更新这些应用程序。非常感谢您的帮助。
回答by Trevor Burnham
I'm a fan of Homebrew. Once you have it installed, you can just do
我是 Homebrew 的粉丝。一旦你安装了它,你就可以做
brew install node
then install npm with
然后安装 npm
curl http://npmjs.org/install.sh | sh
then use it to install CoffeeScript with
然后用它来安装 CoffeeScript
npm install -g coffee-script
If you don't have Homebrew or don't want to bother with it, replace the first step with going to http://nodejs.org/, clicking "Download," and running the latest installer for OS X. No command line wizardry required.
如果您没有 Homebrew 或不想理会它,请将第一步替换为转到http://nodejs.org/,单击“下载”,然后运行 OS X 的最新安装程序。没有命令行需要魔法。
Update:Since this answer was posted, several things have changed. One is that Homebrew includes npm, so you don't need to install it separately (and if you do, you need to use https://). Another is that I would recommend using nvmto install Node rather than Homebrew, since you'll likely want to use different Node versions for different projects at some point and swapping out brew versions is no fun.
更新:自从发布这个答案以来,有几件事发生了变化。一个是 Homebrew 包含 npm,所以你不需要单独安装它(如果你这样做,你需要使用https://)。另一个原因是我建议使用nvm来安装 Node 而不是 Homebrew,因为您可能希望在某个时候为不同的项目使用不同的 Node 版本,并且换出 brew 版本并不好玩。
回答by Andrei Karpushonak
To update only coffee-script:
只更新coffee-script:
sudo npm update coffee-script -g
须藤 npm 更新咖啡脚本 -g
回答by alessioalex
The easiest way to upgrade your Node.js version is to use a version manager such as NVM. It will also keep your old version if you'd like, along with stuff you've installed for it.
升级 Node.js 版本的最简单方法是使用版本管理器,例如NVM。如果您愿意,它还可以保留您的旧版本以及您为其安装的内容。
Once you upgrade you Node version, you can install CoffeeScript via NPM.
升级 Node 版本后,您可以通过 NPM 安装 CoffeeScript。

