ハッカソン夜の部

帰りしな、グリ直也さんが _nvm install v0.6.0 なう_ などとゆー tweet をなさっているのを確認。もしや、と思い帰宅後にググッてみたら nave ではない方法もあるのね、ってことでガソリンを入れつつ夜の部が開始される訳です。

とりあえず

~/.nave は置いておこうかどうしようか。使わない、ってオプションが無いので端末を新たに出そう。で、とりあえず git clone するらしい。

$ git clone git://github.com/creationix/nvm.git ~/.nvm
Initialized empty Git repository in /home/rms/.nvm/.git/
remote: Counting objects: 249, done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 249 (delta 134), reused 222 (delta 111)
Receiving objects: 100% (249/249), 33.61 KiB, done.
Resolving deltas: 100% (134/134), done.
$

で、source すれば OK らしい。

$ source ~/.nvm/nvm.sh
$

わしは年寄りなので bash です。てか、これで nvm が使える状態になってるのか。

$ nvm help

Node Version Manager

Usage:
    nvm help                    Show this message
    nvm install <version>       Download and install a <version>
    nvm uninstall <version>     Uninstall a version
    nvm use <version>           Modify PATH to use <version>
    nvm ls                      List installed versions
    nvm ls <version>            List versions matching a given description
    nvm deactivate              Undo effects of NVM on current shell
    nvm alias [<pattern>]       Show all aliases beginning with <pattern>
    nvm alias <name> <version>  Set an alias named <name> pointing to <version>
    nvm unalias <name>          Deletes the alias named <name>
    nvm copy-packages <version> Install global NPM packages contained in <version> to current version

Example:
    nvm install v0.4.12         Install a specific version number
    nvm use 0.2                 Use the latest available 0.2.x release
    nvm alias default 0.4       Auto use the latest installed v0.4.x version

$

ええと search とかそんなの無いのかな。deactivate とかいいですね。とりあえずインストール可能なソレについては、http://nodejs.org/dist/ を見るしかないらしい。
で、グリ直也さんも言われていたように v0.6.0 をナニ。

$ nvm install v0.6.0

盛大にコンパイルが開始されております。なんかここでも loadave 的問題が出てる気がするのですが大丈夫かなぁ。一応 nvm.sh 見てみたのですが、-j なソレの記述はないように見えます。いちおう loadave も Corei5 で 10 程度。

終わた

Now using node v0.6.0
Installing npm...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7184  100  7184    0     0    261      0  0:00:27  0:00:27 --:--:-- 15156
tar=/bin/tar
version:
tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
fetching: http://registry.npmjs.org/npm/-/npm-1.0.103.tgz
You need node 0.4 || 0.5 to run this program.
node --version reports: v0.6.0
Please upgrade node before continuing.
It failed
$

あら?
0.5.9 も入れとくか。

$ nvm install v0.5.9

また暫く時間がかかるな。RSS 倒すか。

と言いつつ云々してたら

以下。

Now using node v0.5.9
Installing npm...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7184  100  7184    0     0    282      0  0:00:25  0:00:25 --:--:-- 16943
tar=/bin/tar
version:
tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
fetching: http://registry.npmjs.org/npm/-/npm-1.0.103.tgz
0.5.9
1.0.103
cleanup prefix=/home/rms/.nvm/v0.5.9

All clean!
/home/rms/.nvm/v0.5.9/bin/npm -> /home/rms/.nvm/v0.5.9/lib/node_modules/npm/bin/npm-cli.js
/home/rms/.nvm/v0.5.9/bin/npm_g -> /home/rms/.nvm/v0.5.9/lib/node_modules/npm/bin/npm-cli.js
/home/rms/.nvm/v0.5.9/bin/npm-g -> /home/rms/.nvm/v0.5.9/lib/node_modules/npm/bin/npm-cli.js
npm@1.0.103 /home/rms/.nvm/v0.5.9/lib/node_modules/npm 
It worked
$

いちおう 0.6.0 も使えます。

$ nvm use v0.6.0
Now using node v0.6.0
$

ここで npm で git 入れようとしたらどうなるかな。

$ npm install git
No command 'npm' found, did you mean:
 Command 'dpm' from package 'dpm-postgres' (universe)
 Command 'dpm' from package 'dpm-mysql' (universe)
 Command 'apm' from package 'apmd' (main)
 Command 'rpm' from package 'rpm' (main)
 Command 'gpm' from package 'gpm' (universe)
 Command 'pm' from package 'powerman' (universe)
 Command 'nm' from package 'binutils' (main)
 Command 'nm' from package 'binutils-multiarch' (universe)
 Command 'fpm' from package 'fpm2' (universe)
 Command 'nam' from package 'nam' (universe)
 Command 'npg' from package 'netdisco-backend' (universe)
 Command 'epm' from package 'epm' (universe)
npm: command not found
$

げ。ってなんか分からん内に PATH に入ってたなorz
でも実行は駄目。

$ npm install git
npm ERR! TypeError: Cannot read property 'latest' of undefined
npm ERR!     at /home/rms/.nvm/v0.5.9/lib/node_modules/npm/lib/cache.js:396:35
npm ERR!     at saved (/home/rms/.nvm/v0.5.9/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:136:7)
npm ERR!     at Object.cb [as oncomplete] (/home/rms/.nvm/v0.5.9/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! 
npm ERR! System Linux 2.6.35-22-generic
npm ERR! command "node" "/home/rms/.nvm/v0.5.9/bin/npm" "install" "git"
npm ERR! cwd /home/rms
npm ERR! node -v v0.5.9
npm ERR! npm -v 1.0.103
npm ERR! type non_object_property_load
npm ERR! arguments [ 'latest', undefined ]
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/rms/npm-debug.log
npm not ok
$

ええと、npm search とかもできん。あ、v0.6.0 だと npm が使えないのかな。どっちにしても駄目杉。ログ見てみたら

verbose url resolving [ 'http://packages.dojofoundation.org/',

これだな。~/.npmrc を以下に修正。

registry = http://registry.npmjs.org/

で、リトライ。したのですが結局昼に出た compress@0.1.9 なエラーが出ている模様。

$ npm install compress@0.1.9
npm ERR! Error: No dist in undefined package
npm ERR!     at /home/rms/.nvm/v0.5.9/lib/node_modules/npm/lib/cache.js:424:26
npm ERR!     at saved (/home/rms/.nvm/v0.5.9/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:136:7)
npm ERR!     at Object.cb [as oncomplete] (/home/rms/.nvm/v0.5.9/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! 
npm ERR! System Linux 2.6.35-22-generic
npm ERR! command "node" "/home/rms/.nvm/v0.5.9/bin/npm" "install" "compress@0.1.9"
npm ERR! cwd /home/rms
npm ERR! node -v v0.5.9
npm ERR! npm -v 1.0.103
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/rms/npm-debug.log
npm not ok
$

とほほ。ってか、nvm use 0.6.0 したら npm が使えないんですが、これは一体どーゆー意味なんだろう。

とりあえず

express を導入してみましょう。

$ npm install express -g

なんか .npmrc が微妙だったんですが詳細は略。基本的に registry なエントリは一つってことでよろしくです。

$ npm install express -g
/home/rms/.nvm/v0.5.9/bin/express -> /home/rms/.nvm/v0.5.9/lib/node_modules/express/bin/express
mkdirp@0.0.7 /home/rms/.nvm/v0.5.9/lib/node_modules/express/node_modules/mkdirp 
mime@1.2.4 /home/rms/.nvm/v0.5.9/lib/node_modules/express/node_modules/mime 
qs@0.3.1 /home/rms/.nvm/v0.5.9/lib/node_modules/express/node_modules/qs 
connect@1.7.2 /home/rms/.nvm/v0.5.9/lib/node_modules/express/node_modules/connect 
express@2.5.0 /home/rms/.nvm/v0.5.9/lib/node_modules/express 
$

普通に入りました。調子にのって git も試してみましたが、やはり compress@0.1.9 が云々で駄目ですな。ちなみに npm list の結果はあまり変わらない。

$ npm list
/home/rms
└─┬ express@2.5.0 
  ├── connect@1.7.2 
  ├── mime@1.2.4 
  ├── mkdirp@0.0.7 
  └── qs@0.3.1 
$

結局同じ場所に着地してます。ちょっとだけ v0.6.0 に期待したんですが npm が使えないあたりはまだこれからなのに違いない。

あら?

もしかして node のバージョンを順に巻き戻したらそのうち compress が使えるようになるのかな。ちょっと試験してみるか。とりあえず v0.5 だと 1 から 10 まで使えるらしい。二分探索で v0.5.5 から始めるか。

$ nvm install v0.5.5

完了したので以下。

$ nvm use 0.5.5
Now using node v0.5.5
$ npm install compress

固まりよったorz