Skip to content

Instantly share code, notes, and snippets.

@TooTallNate
Created August 7, 2012 18:55
Show Gist options
  • Select an option

  • Save TooTallNate/3288316 to your computer and use it in GitHub Desktop.

Select an option

Save TooTallNate/3288316 to your computer and use it in GitHub Desktop.
Simple Node.js installation script using the precompiled binary tarballs
#!/bin/sh
VERSION=0.8.6
PLATFORM=darwin
ARCH=x64
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
mkdir -p "$PREFIX" && \
curl http://nodejs.org/dist/v$VERSION/node-v$VERSION-$PLATFORM-$ARCH.tar.gz \
| tar xzvf - --strip-components=1 -C "$PREFIX"

Starting with node v0.8.6, we're gonna be releasing official binary tarballs of the releases for the most common platform+architecture combos.

Here's a simple script that will install node using a simple curl | tar piping. By default the files will get installed into your HOME directory. Change the PREFIX variable to /usr/local if you're feeling ambitious (note: you may need to run this as root depending on the PREFIX).

@tj

tj commented Aug 7, 2012

Copy link
Copy Markdown

:D this should have been done like 2 years ago haha

@TooTallNate

Copy link
Copy Markdown
Author

Better late than never!

@rauchg

rauchg commented Aug 8, 2012

Copy link
Copy Markdown

Very hot @TooTallNate

@niloy

niloy commented Aug 8, 2012

Copy link
Copy Markdown

Where is the make command to install node?

@niloy

niloy commented Aug 8, 2012

Copy link
Copy Markdown

Oh sorry, got it, this is directly downloading the binary.

@3rd-Eden

3rd-Eden commented Aug 8, 2012

Copy link
Copy Markdown

@visionmedia can't wait to have this integrated in to n ;)

@fhemberger

Copy link
Copy Markdown

For those who don't need a full fledged 'n', I edited the script a bit to always download the latest stable version, if it's not already installed:
https://gist.github.com/3983497

@mlconnor

Copy link
Copy Markdown

This is great but I'm having trouble using npm. I see that npm is included with the binaries but it seems that we need environment variables for where the global repository is. Can anyone provide details on how to configure npm this once you download the binaries?

@ankurk91

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment