使用gem安裝成功後如何在Mac上執行Node.js?

使用gem安裝成功後如何在Mac上執行Node.js?

在 Mac OSX Yosemite 上我已成功安裝節點:

# sudo gem install node
Fetching: eventmachine-1.0.7.gem (100%)
Building native extensions.  This could take a while...
Successfully installed eventmachine-1.0.7
Fetching: node-0.0.2.gem (100%)
Successfully installed node-0.0.2
Parsing documentation for eventmachine-1.0.7
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/fastfilereaderext.bundle, skipping
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/rubyeventmachine.bundle, skipping
Installing ri documentation for eventmachine-1.0.7
Parsing documentation for node-0.0.2
Installing ri documentation for node-0.0.2
2 gems installed

我在已安裝的 gem 清單中看到它:

# gem list --local

*** LOCAL GEMS ***

activesupport (3.2.17)
bigdecimal (1.2.0)
CFPropertyList (2.2.8)
claide (0.7.0, 0.5.0)
cocoapods (0.35.0, 0.32.1)
cocoapods-core (0.35.0, 0.32.1)
cocoapods-downloader (0.8.1, 0.5.0)
cocoapods-plugins (0.3.2)
cocoapods-trunk (0.4.1)
cocoapods-try (0.4.3, 0.2.0)
colored (1.2)
escape (0.0.4)
eventmachine (1.0.7)
fuzzy_match (2.0.4)
i18n (0.7.0, 0.6.9)
io-console (0.4.2)
json (1.7.7)
json_pure (1.8.1)
libxml-ruby (2.6.0)
minitest (5.5.1, 4.3.2)
molinillo (0.1.2)
multi_json (1.9.2)
nap (0.8.0, 0.7.0)
netrc (0.7.8)
node (0.0.2)
nokogiri (1.5.6)
open4 (1.3.3)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
sqlite3 (1.3.7)
test-unit (2.0.0.0)
thread_safe (0.3.4)
tzinfo (1.2.2)
xcodeproj (0.20.2, 0.16.1)

但是,當我嘗試使用它時(相同應用程式.js檔案在 Windows 7 上運作良好)- 未找到 Node.js 解釋器:

# node app.js
-bash: node: command not found
# sudo node app.js
sudo: node: command not found

也沒有節點文件下/usr/local/bin

請告訴我,如何開始使用已安裝的 Node.js?

我有一種感覺,這裡缺少了一點點。

答案1

對於 Node.js 專案的所有炒作來說,這個 gem 就是一個笑話。

它只包含 eventmachine gem 並為其新增一個新別名。

https://github.com/rafaelfranca/node

跑步

sudo apt-get update

sudo apt-get install nodejs

或者

brew update

brew install node

相關內容