Installing node and npm on a Joyent SmartMachine

Installing node and npm on a Joyent SmartMachine

Here are some updated instructions for installing the latest stable version of node (v0.4.12), as well as npm, on a Joyent SmartMachine.

These instructions install node in the ~/local directory avoiding the need for root privileges when installing things with npm, which is bad.

First, create a ~src/ directory — this is where we’ll download the latest version of node.

mkdir ~/src
cd ~/src
curl -O

Now untar it:

gtar -xpf node-v0.4.12.tar.

Create the ~/local directory if it doesn’t already exist:

mkdir ~/local

Now lets add it to your PATH:

echo 'export PATH=$HOME/local/bin:${PATH}' >> ~/.bashrc 
. ~/.bashrc

Now, configure, build, and install node:

cd node-v*
./configure --with-dtrace --prefix=~/local
gmake install

The gmake part will probably take the longest. And you’ve probably noticed I’m using gtar instead of tar and gmake instead of make. There are some difference between the Solaris versions and the GNU versions.

Ok, now let’s get things setup for npm:

echo tar = gtar >> ~/.npmrc
echo root = $HOME"/.node_libraries" >> ~/.npmrc
echo binroot = $HOME"/local/bin" >> ~/.npmrc
echo manroot = $HOME"/local/share/man" >> ~/.npmrc

Ok, now lets install npm:

curl | sh

And that’s it!

Show Comments