|AJ ONeal 22c741817c||9 months ago|
|.gitignore||6 years ago|
|LICENSE||6 years ago|
|README.md||9 months ago|
|install.sh||1 year ago|
|setup-deps-mavericks.bash||3 years ago|
|setup-deps-ubuntu.bash||3 years ago|
|setup-min.sh||3 years ago|
|setup-node-mavericks.bash||2 years ago|
|setup-node-ubuntu.bash||1 year ago|
|setup-raspbian.sh||6 years ago|
|setup.bash||3 years ago|
This method still has its place, but I've bee collaborating on webinstall.dev and intend for future development to move there.
curl https://webinstall.dev/node | bash
| A Root Project |
Simple node.js installer for macOS and Linux
curl -fsL bit.ly/node-installer | bash
Note: bit.ly/node-installer is a redirect to https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master/install.sh
The latest version of node is installed by default.
You can choose a specific version by defining
NODE_VERSION in the format
export NODE_VERSION=v10.10 curl -fsSL https://bit.ly/node-installer | bash
By default node will be installed to
/usr/local, without root if possible.
You can choose a specific location by setting both
export NPM_CONFIG_PREFIX=$HOME/.local export NODE_PATH=$NPM_CONFIG_PREFIX/lib/node_modules curl -fsSL https://bit.ly/node-installer | bash
If you want to add the install location to your
/bin to the custom location used above and append it like so:
If you plan on building or creating native node modules, you'll want to install
pgk-config, and a few other required tools and niceties.
In fact, it's fairly common for modules to have both native module and pure js dependencies, so you'll probably want (or need) to install these even if you don't plan to use them directly.
--dev-deps to the installer script and it will use either
brew (on macOS) or
apt (on Linux) to install the development tools.
curl -fsSL https://bit.ly/node-installer | bash -s -- --dev-deps
Or, if you don't have
curl installed yet you can use
wget -nv https://bit.ly/node-installer -O - | bash -s -- --dev-deps
If you're running a node.js server on anything with a public ip address
(an "edge" server), I'd highly recommend that you also install
fail2ban to secure ssh -
especially if you haven't switched your server to use key-only authentication (which you should also do).
First you need to Install XCode Command Line Tools
Then you need to Accept the XCode License by running any command installed by Xcode with sudo. We'll use git.
sudo git --version
You can scroll to the bottom by hitting shift+G (capital G).
agree and hit enter to accept the license.
Now you can install node.js
curl -fsSL https://bit.ly/node-installer -o /tmp/node-installer.sh; bash /tmp/node-installer.sh --dev-deps
TODO: Make it easier to accepting the license (automatic?)
wget -nv https://bit.ly/node-installer -O /tmp/node-installer.sh; bash /tmp/node-installer.sh --dev-deps
Fun FYI, here's how the latest version is determined:
NODE_VERSION=$(curl -fsSL https://nodejs.org/dist/index.tab | tail -n +2 | cut -f 1 | head -1 ) echo "The current node.js version is $NODE_VERSION"
BASE_VER="v10\\." NODE_VERSION=$(curl -fsSL https://nodejs.org/dist/index.tab | tail -n +2 | cut -f 1 | grep $BASE_VER | head -1 ) echo "Latest node.js $BASE_VER is $NODE_VERSION"