Developing with node.js and iojs
Recently, I’ve seen a few people asking about running both node.js and iojs concurrently, especially during the development lifecycle of an application. There are a couple of routes that one can take to accomplish this.
node-bin / iojs-bin
$ npm install — save node-bin
$ npm install — save iojs-bin
Say you wanted to use node on this particular project. In your package.json, you could create a start script like so:
“start”: “./node_modules/.bin/node index.js”
To use iojs, simply change your package.json to look something like:
“start”: “./node_modules/.bin/iojs index.js”
Thanks to @aredridel for node-bin and iojs-bin!
A slightly different solution to solve this problem would be to use a version manager like nvm. One can follow the instructions in the readme to install nvm.
First, install a version of node:
$ nvm install 0.12
Then, install a version of iojs:
$ nvm install iojs
To activate one of the versions:
$ nvm use iojs
# nvm use 0.10
Being that my preferred shell is fish and nvm does not work with fish, I had to explore other alternatives. Enter n.
n is similar to nvm in some ways, but it actually works with fish.
To install n:
$ npm install -g n
n has very similar commands to nvm. Running n without any arguments will show a list of available versions to install or activate.
To install the latest version of node:
$ n latest
To install the latest version of iojs:
$ n io latest
That wraps it up. If you have any questions/comments/issues, please feel free to reach out to me @evanhlucas!