在OSX上安装nodejs的最佳方法是什么?

时间:2023-01-22 20:16:54

I see you can download nodejs via homepage or install via homebrew or via macports.

我看到你可以通过主页下载nodejs或通过homebrew或macports安装。

which is the best method?

哪种方法最好?

Is there a reason for choosing one over the other?

是否有理由选择一个而不是另一个?

Some things I consider:
1. Ease of upgrading to latest version
2. Ability to (fully) remove and uninstall
3. 1 and 2 should leave no trace of old version (including any temp files), or in case of uninstalling, should fully remove everything. 

3 个解决方案

#1


4  

Use the Mac OS X Installer as upgrading is easier in the future.

使用Mac OS X Installer将来更容易升级。

#2


25  

I prefer to use brew.

我更喜欢使用brew。

once installed its as easy as:

一旦安装好就像:

brew install node

brew安装节点

Done and done.

做完了。

Don't want it anymore?

不要再想了吗?

brew uninstall node

brew卸载节点

Need to upgrade?

需要升级吗?

brew upgrade node

brew升级节点

Plus, its based on git and the community is very active. Furthermore, the packages that are installed are always in one place, then symlinked to your /usr/local/bin, so no messy sudo or multiple install locations.

另外,它基于git和社区非常活跃。此外,安装的软件包总是在一个地方,然后符号链接到您的/ usr / local / bin,因此没有杂乱的sudo或多个安装位置。

Checkout the site here

在这里查看网站

#3


4  

I personally like to compile from source. https://github.com/joyent/node/wiki/Installation

我个人喜欢从源代码编译。 https://github.com/joyent/node/wiki/Installation

You can use NVM for upgrades and downgrades and even switching between different versions at any moment! https://github.com/creationix/nvm

您可以使用NVM进行升级和降级,甚至可以随时在不同版本之间切换! https://github.com/creationix/nvm

#1


4  

Use the Mac OS X Installer as upgrading is easier in the future.

使用Mac OS X Installer将来更容易升级。

#2


25  

I prefer to use brew.

我更喜欢使用brew。

once installed its as easy as:

一旦安装好就像:

brew install node

brew安装节点

Done and done.

做完了。

Don't want it anymore?

不要再想了吗?

brew uninstall node

brew卸载节点

Need to upgrade?

需要升级吗?

brew upgrade node

brew升级节点

Plus, its based on git and the community is very active. Furthermore, the packages that are installed are always in one place, then symlinked to your /usr/local/bin, so no messy sudo or multiple install locations.

另外,它基于git和社区非常活跃。此外,安装的软件包总是在一个地方,然后符号链接到您的/ usr / local / bin,因此没有杂乱的sudo或多个安装位置。

Checkout the site here

在这里查看网站

#3


4  

I personally like to compile from source. https://github.com/joyent/node/wiki/Installation

我个人喜欢从源代码编译。 https://github.com/joyent/node/wiki/Installation

You can use NVM for upgrades and downgrades and even switching between different versions at any moment! https://github.com/creationix/nvm

您可以使用NVM进行升级和降级,甚至可以随时在不同版本之间切换! https://github.com/creationix/nvm