How to install npm in alpine linux
For the recent versions of Alpine (v3.8+) the correct way to install nodejs with npm is:
apk add --update nodejs npm
However, npm
package depends on nodejs
, so you can do:
apk add --update npm
Note: since Alpine 3.8 there is no nodejs-npm package.
I had an issue with the apk manager.
The package nodejs is no longer installing NPM (see pkgs.alpinelinux.org) You have to install nodejs-npm
apk add --update nodejs nodejs-npm
I could be wrong, but I think npm
is actually a dependency of nodejs
.
I've never seen any flavor of package manager install npm
alone. Always seems to come packaged with yum install nodejs
, or apt-get install nodejs
, or apk add --update nodejs
.
apk update && apk add nodejs
installed the npm
binary for me.