Install Npm Alpine

3.4.1. Public. Published 20 hours ago. This package does not have a README. Add a README to your package so that users know how to get started. Apk add -update nodejs nodejs-npm. 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 could be wrong, but I think npm is actually a dependency.

Alpine's Intersect plugin is a convenience wrapper for Intersection Observer that allows you to easily react when an element enters the viewport.

This is useful for: lazy loading images and other content, triggering animations, infinite scrolling, logging 'views' of content, etc.


Install Npm Alpine

You can use this plugin by either including it from a <script> tag or installing it via NPM:



You can include the CDN build of this plugin as a <script> tag, just make sure to include it BEFORE Alpine's core JS file.


You can install Intersect from NPM for use inside your bundle like so:

Then initialize it from your bundle:


The primary API for using this plugin is x-intersect. You can add x-intersect to any element within an Alpine component, and when that component enters the viewport (is scrolled into view), the provided expression will execute.

For example, in the following snippet, shown will remain false until the element is scrolled into view. At that point, the expression will execute and shown will become true:


Npm Install Ag-theme-alpine

Scroll Down 👇


You can opt to only trigger x-intersect when the element ENTERS the viewport by adding the :enter suffix to x-intersect like so:


Similarly, you can add :leave to only trigger x-intersect when the element LEAVES the viewport:



Sometimes it's useful to evaluate an expression only the first time an element enters the viewport and not subsequent times. For example when triggering 'enter' animations. In these cases, you can add the .once modifier to x-intersect to achieve this.

Code highlighting provided by Torchlight

Alpine Linux, unlike mainstream/traditional Linux distributions, is based on BusyBox, a very compact (~5MB) Linux distribution. BusyBox (and thus Alpine Linux) uses a different C/C++ stack to most mainstream/traditional Linux distributions - musl. There currently is no musl based binary published in the nodejs official builds but they do publish a musl based binary in the nodejs unofficial builds which they use in the node:alpine docker image. The node:alpine docker image is a potential alternative to nvm for using node on alpine linux.

Install npm alpine windows

For now you can override the nvm_get_arch function to return x64-musl on x64 Alpine Distributions. Currently the Node project only has unofficial builds for x64-musl. Sorry no ARM-musl/x86-musl,etc builds for now. The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Official Alpine-compatible binaries.

For more info about unofficial builds visit:

Install Npm Alpine

If installing nvm on Alpine Linux is still what you want or need to do, you should be able to achieve this by running one of the following from your Alpine Linux shell:

Using Precompiled Binaries on Alpine

Pre-compiled binaries for musl based architectures are unofficially available for most node versions after node v8.16.0

  • libstdc++ - is the only package that is necessary to run node/npm once it is installed.
  • bash - is required to install nvm... BusyBox's sh has some issues with chmoding the nvm-exec file, but bash can be removed again after install if you want to slim your image.
  • coreutils/curl - is required to for nvm because BusyBox is not 100% POSIX compliant. Mainly ls not accepting a -q argument and wget not having the progress bar option.

Since there are no io.js builds available for musl you can also disable all io.js versions from showing up in nvm ls-remote by also running:

Install Npm Alpine Windows

Building from Source on Alpine

There is a -s flag for nvm install which requests nvm download Node source and compile it locally. This does not use anything unofficial but it is much slower and more cpu intensive to install and build each version of node.


Similar to the pre-compiled binaries

  • libstdc++ - is the only package that is necessary to run node/npm once it is installed.