From 337ddbac161198a9ac9e9005daf17d3cb5e541d6 Mon Sep 17 00:00:00 2001 From: Neil Craig Date: Wed, 1 Jun 2016 13:33:16 +0100 Subject: [PATCH] Lowercase NVM Lowercase NPM Ref @mhart Add information WRT installling on Alpine Linux --- README.markdown | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 058f57b..318d8e7 100644 --- a/README.markdown +++ b/README.markdown @@ -255,7 +255,7 @@ To activate, you need to source `bash_completion`: [[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion -Put the above sourcing line just below the sourcing line for NVM in your profile (`.bashrc`, `.bash_profile`). +Put the above sourcing line just below the sourcing line for nvm in your profile (`.bashrc`, `.bash_profile`). ### Usage @@ -302,6 +302,25 @@ Shell settings: set -e ``` +## Installing nvm on Alpine Linux +In order to provide the best performance (and other optimisations), nvm will download and install pre-compiled binaries for Node (and npm) when you run `nvm install X`. The Node project compiles, tests and hosts/provides pre-these compiled binaries which are built for mainstream/traditional Linux distributions (such as Debian, Ubuntu, CentOS, RedHat et al). + +Alpine Linux, unlike mainstream/traditional Linux distributions, is based on [busybox](https://www.busybox.net/), a very compact (~5MB) Linux distribution. Busybox (and thus Alpine Linux) uses a different C/C++ stack to most mainstream/traditional Linux distributions - [musl](https://www.musl-libc.org/). This makes binary programs built for such mainstream/traditional incompatible with Alpine Linux, thus we cannot simply `nvm install X` on Alpine Linux and expect the downloaded binary to run correctly - you'll likely see "...does not exist" errors if you try that. + +There is a `-s` flag for `nvm install` which requests nvm download Node source and compile it locally but currently (May 2016), this is not available for Node versions newer than v0.10 so unless you need an older Node version, this won't help you. Work is in progress on source-builds for newer Node versions but is not yet complete. + +If installing nvm on Alpine Linux *is* still what you want or need to do, you should be able to achieve this by running the following from you Alpine Linux shell: + +``` +apk add bash +wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | /bin/bash +``` + +The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Alpine-compatible binaries. + +As a potential alternative, @mhart (a Node contributor) has some [Docker images for Alpine Linux with Node and optionally, npm, pre-installed](https://github.com/mhart/alpine-node). + + ## Problems If you try to install a node version and the installation fails, be sure to delete the node downloads from src (~/.nvm/src/) or you might get an error when trying to reinstall them again or you might get an error like the following: