如何在 Mac 上使用 gem 成功安装 Node.js 后运行它?

如何在 Mac 上使用 gem 成功安装 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 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/本地/bin

请告知我,如何开始使用已安装的 Node.js?

我感觉这里缺少了一点点。

答案1

对于 node.js 项目的所有炒作来说,这个宝石只是一个笑话。

它仅包含 eventmachine gem 并为其添加了一个新别名。

https://github.com/rafaelfranca/node

跑步

sudo apt-get update

sudo apt-get install nodejs

或者

brew update

brew install node

相关内容