Node.js Selector can now keep one copy of each npm package version on a server and share it with every application that uses it. With the new Shared node_modules Store, a package version that one application has already installed isn’t downloaded or stored again for the next. The server links the same files into each application’s node_modules folder.

Account owners who run Node.js applications through Node.js Selector don’t change anything. They still click Run NPM Install in the panel or run npm install, and their applications keep running on the Node.js version they selected.

The Shared Store is in beta and included in every CloudLinux license tier.

Why it matters on a hosting server

  • Less duplicate data on disk, fewer repeated downloads. Many applications use the same packages, and until now each one kept its own copy. With the Shared Store, applications can now share files when they use the same package versions. The total disk saving on the server depends on how similar the applications are.
  • Shared files don’t count toward the account’s quota. That covers both disk space and inodes. The account’s own files, including any private copies of packages, still count. The Shared Store has a status command that shows how much the Store itself holds, and you can cap it with a soft storage limit.

How it works

The Shared Store keeps package files in a shared cache on the server, owned by root. Applications get them through hardlinks, so one file on disk appears in every application that uses it. Accounts can read the shared files but can’t change them.

The cl-bun package provides the install engine, while applications still run on their selected Node.js version.

Packages that need extra setup or a build are not shared. They get private copies for each application, and their install scripts run as the account user.

Key details to know before you enable it

  • Only full installs use the Shared Store. That means Run NPM Install, or npm install with no package name, which installs everything the application’s package.json lists. Other commands that change dependencies, such as npm install <package>, npm update and npm ci, bypass the Shared Store and install packages the usual way, with a separate copy for the application. Since shared files can’t be changed, these commands first replace the application’s shared files with private copies, which count toward the account’s quota. The next full install can share them again.
  • One package registry per server, the public npm registry by default. Installs that need Git dependencies, local paths, tarball URLs or a private registry stop with an error that gives the reason. To let an account use those sources, exclude it from the Shared Store, and its installs work as they did before.
  • The Shared Store’s storage directory has to be on the same filesystem as the account homes it serves. That’s because hardlinks can’t cross filesystems.
  • Existing applications don’t change when you enable it. They move to the Shared Store on their next install. You can also convert them with cloudlinux-selector migrate, which keeps the old dependencies until the application passes a health check.
  • Restored and transferred accounts may get private copies, which use their full disk space until a later install shares them again.
  • Check anything that resets ownership or permissions in account homes. A recursive chown or chmod over a home or its node_modules also changes the shared files, because a hardlink is the same file in every application that uses it. cl-node-modules-storage status warns when it finds this.

Availability

  • CloudLinux 7, 8, 9, and 10; x86_64 only.
  • Node.js Selector on cPanel, DirectAdmin, or a custom panel that integrates it through its API
  • LVE Manager 7.11.49-1 or later, with cl-bun 1.4.0-1
  • Every CloudLinux license tier

How to get started

The Shared Store is off by default, so just installing the update doesn’t turn it on.

  1. Update the packages from the beta repository:
    yum install lvemanager cl-bun --enablerepo=cloudlinux-updates-testing
  2. As root, run
    1. cl-node-modules-storage enable (If account homes are on a separate /home filesystem, add --storage-path /home/.cl-node-modules-storage to the enable command.)
    2. then cl-node-modules-storage status, and look for feature_status: enabled.
  3. In Node.js Selector, open an application and click Run NPM Install.

The Shared node_modules Store documentation covers configuration, converting existing applications, monitoring and cleanup. This is a beta, so tell us how it runs on your servers, and if you need any further assistance, contact our support team.