Blog | Phodal - A Growth Engineerhttp://www.phodal.com/blog/2015-06-23T05:43:22.045264+00:00Blogio.js nvm 安装2015-02-07T12:19:26+00:002015-06-23T05:43:22.045264+00:00Phodal Huanghttp://www.phodal.com/blog/author/root/http://www.phodal.com/blog/nvm-install-io.js/nodejs和io.js算是打了起来了,这时候受罪的不应该是我们,受罪的是npm和nvm。幸运的是nvm支持iojs。
##nvm io.js安装
###更新nvm
看了看原来的nvm版本
nvm --version
发现是
0.17.3
先更新brew,再更新iojs
brew update
brew upgrade nvm
最后返回了
/usr/local/Cellar/nvm/0.23.3: 5 files, 68K, built in 83 seconds
###nvm io.js安装
于是就有了
nvm install iojs
默默地发现这时候版本变了
v1.1.0
更新狂人io.js直接超越了node.js的``0.12.0``。
执行了下
nvm list
发现他们愉快地在一起了。
iojs-v1.1.0
v0.8.28
v0.9.12
v0.10.32
v0.10.33
v0.10.35
v0.10.36
v0.11.13
v0.11.14
-> system
stable -> 0.10 (-> v0.10.36) (default)
unstable -> 0.11 (-> v0.11.14) (default)
##nvm io.js测试
这时候想了想,还是找个之前的repo,测试一下io.js是不是兼容node的
删除了之前的modules
sudo rm -rf node_modules
重装安装
sudo npm install
测试
npm test
结果挂了
coap
✓ should error with a wrong URL (128ms)
✓ should GET a given resource by default (143ms)
✓ should GET a given resource by default (bis) (148ms)
✓ should GET not adding a newline (short) (138ms)
✓ should print help if no url (117ms)
✓ should not print status code on quiet option (139ms)
✓ should only emit status code if the response was a 4.04 (138ms)
✓ should GET a given resource by specifying the verb (134ms)
1) should PUT a given resource
8 passing (3s)
1 failing
也有这样的错误
npm WARN engine cucumber@0.4.7: wanted: {"node":"0.8 || 0.10 || 0.11"} (current: {"node":"1.1.0","npm":"2.5.0"})
这表明众多nodejs的开发者又要支持双"系统"了。io.js 编译 安装2015-02-07T12:05:48+00:002015-02-07T12:53:44.662049+00:00Phodal Huanghttp://www.phodal.com/blog/author/root/http://www.phodal.com/blog/mac-os-compile-iojs/试了试在[Mac OS下安装IO.js](http://www.phodal.com/blog/mac-os-x-install-io.js/),决定编译试试。
##IO.js 编译
看了看官网列举的条件
- ``gcc`` and ``g++ 4.8`` or newer, or
- ``clang`` and ``clang++ 3.3`` or newer
- Python 2.6 or 2.7
- GNU Make 3.81 or newer
- libexecinfo (FreeBSD and OpenBSD only)
1.Clone代码
git clone git@github.com:iojs/io.js.git
无奈的是很慢,因为很大
Cloning into 'io.js'...
remote: Counting objects: 141542, done.
remote: Compressing objects: 100% (119/119), done.
Receiving objects: 13% (19198/141542), 15.54 MiB | 118.00 KiB/s
Receiving objects: 13% (19254/141542), 15.69 MiB | 107.00 KiB/s
Receiving objects: 25% (35386/141542), 44.27 MiB | 144.00 KiB/s
Receiving objects: 27% (39541/141542), 52.86 MiB | 88.00 KiB/s KiB/s
2.编译
$ ./configure
生成了一堆参数
creating ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
'default_configuration': 'Release',
'defines': [],
'include_dirs': [],
'libraries': []},
'variables': { 'host_arch': 'x64',
'icu_small': 'false',
'node_install_npm': 'true',
'node_prefix': '',
'node_shared_http_parser': 'false',
'node_shared_libuv': 'false',
'node_shared_openssl': 'false',
'node_shared_v8': 'false',
'node_shared_zlib': 'false',
'node_tag': '',
'node_use_dtrace': 'true',
'node_use_etw': 'false',
'node_use_mdb': 'false',
'node_use_openssl': 'true',
'node_use_perfctr': 'false',
'openssl_no_asm': 0,
'python': '/Users/fdhuang/py27/bin/python',
'target_arch': 'x64',
'uv_library': 'static_library',
'uv_parent_path': '/deps/uv/',
'uv_use_dtrace': 'true',
'v8_enable_gdbjit': 0,
'v8_enable_i18n_support': 0,
'v8_no_strict_aliasing': 1,
'v8_optimized_debug': 0,
'v8_random_seed': 0,
'v8_use_snapshot': 'false',
'want_separate_host_toolset': 0}}
creating ./config.gypi
creating ./config.mk
然后
$ make
直到
ln -fs out/Release/iojs iojs
接着
$ [sudo] make install
发现直接把node给替换掉了。。。
ln -fs out/Release/iojs iojs
/Users/fdhuang/py27/bin/python tools/install.py install '' '/usr/local'
installing /usr/local/bin/iojs
symlinking iojs -> /usr/local/bin/node
3.运行所有的测试
$ make test
发现io.js的构造系统好强悍
/Applications/Xcode-Beta.app/Contents/Developer/usr/bin/make -C out BUILDTYPE=Release V=1
make[1]: Nothing to be done for `all'.
ln -fs out/Release/iojs iojs
/Users/fdhuang/py27/bin/python tools/test.py --mode=release message parallel sequential -J
io.js 安装2015-02-07T11:55:30+00:002015-02-07T12:42:58.289047+00:00Phodal Huanghttp://www.phodal.com/blog/author/root/http://www.phodal.com/blog/mac-os-x-install-io.js/ 引用一些之前的故事:
>Node.js作为服务器编程语言的后起之秀,常用来构建和运行Web应用,近日却爆出其社区出现分裂。由于对官方运营商Joyent公司在Node.js管理上的长期不满,多位核心开发者另立门户,创建了分支Io.js。
##IO.js
> Io.js是基于Node.js的npm兼容平台。
###Mac OS Homebrew 下安装
在Homebrew安装
brew install iojs
然而安装完后我们并不能直接使用iojs
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/iojs-1.1.0.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/iojs-1.1.0.yosemite.bottle.tar.gz
==> Pouring iojs-1.1.0.yosemite.bottle.tar.gz
==> Caveats
iojs was installed without npm.
iojs currently requires a patched npm (i.e. not the npm installed by node).
This formula is keg-only, which means it was not symlinked into /usr/local.
iojs conflicts with node (which is currently more established)
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/iojs/lib
CPPFLAGS: -I/usr/local/opt/iojs/include
==> Summary
🍺 /usr/local/Cellar/iojs/1.1.0: 46 files, 12M
于是简单地使用这个来启动server
/usr/local/Cellar/iojs/1.1.0/bin/iojs diaonan.js
看上去似乎没有不兼容,难道从今天起我们就要用io.js了?