簡體   English   中英

在 Mac 上安裝 node.js 的最佳方式?

[英]The best way to install node.js on a Mac?

Homebrew 和 Node 下載頁面在明顯沖突的不同位置安裝 node.js。 如果兩個位置都被使用,Brew 會在“brew doctor”之后抱怨。

那么,是否有一種首選方法可以將節點放在我的 Mac(Yosemite 10.10.5)上。

這就是我現在嘗試通過 brew 安裝節點時得到的。

node-4.1.0 already installed, it's just not linked
DONs-iMac:Erlang-Elixir donfox1$ brew link node
Linking /usr/local/Cellar/node/4.1.0... 
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.

你有沒有試過 chmoding 755 /usr/local/share/systemtap/tapset 所以它是可寫的? 那能修嗎?

chmod 755 /usr/local/share/systemtap/tapset
brew link node 

如果它不起作用(可能會起作用),也試試這個:

brew cleanup
brew link node
brew uninstall node
brew install node

sudo chown -R $USER /usr/local/share/ brew doctor brew install node

卸載節點: sudo rm -rf /usr/local/share/systemtap/ && brew uninstall node並使用 brew 安裝 nvm - 這樣您就可以控制您的節點版本。 閱讀這篇文章: 使用 brew 安裝 npm 的建議方法

如果您不確定您現在需要什么版本的節點以及將來可能需要什么版本,我還建議您安裝 NVM - 節點版本管理器。
通過 cURL 下載 nvm 安裝腳本:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash

確保使用nvm --version正確安裝了nvm --version ,這應該返回安裝的 nvm 版本。
安裝你想要的 Node.js 版本
使用nvm install node安裝最新版本
使用最新版本的nvm use node
使用nvm install --lts安裝最新的 LTS 版本
使用帶有nvm use --lts的最新 LTS 版本

您還可以查看教程:
安裝節點js-tutorial-using-nvm-on-mac-os-x-and-ubuntu
在 Mac 上安裝和使用 nvm 的最佳方式

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM