How to Install NodeJS on OSX Sierra

Grab the download from Node.js Downloads and install it on your main system

... or a less intrusive way with an official Node.js Docker image from node:

$ docker run -it node:6.9.1-alpine node --version
Unable to find image 'node:6.9.1-alpine' locally
6.9.1-alpine: Pulling from library/node
3690ec4760f9: Pull complete
419f814deb4f: Pull complete
Digest: sha256:89f054ffcabab2a016a74fc6313f7be8826156157517e529c0c19d061299dd82
Status: Downloaded newer image for node:6.9.1-alpine

Now you can prepare your own local and persistent Node.js setup (e.g. Apache Cordova):

$ docker run -it node:6.9.1-alpine /bin/sh
npm install -g cordova@6.2.0
npm info ok

Commit the installation:

$ docker commit 2ceafe7050e6 local-dev-cordova:6.2.0

and you have a nice reusable Cordova 6.2.0 image:

$ docker run -it --rm local-dev-cordova:6.2.0 cordova --version

Now, imaging you want to run the cordova command in the current directory on the host, you can do this with this neat little command:

$ docker run -it --rm -v $(pwd):$(pwd) -w $(pwd) local-dev-cordova:6.2.0 cordova -v

Or enter the container and directly change into the current directory:

$ docker run -it --rm -v $(pwd):$(pwd) -w $(pwd) local-dev-cordova:6.2.0 /bin/sh
Show Comments