Adding NodeJS to your Shell
devbox add nodejs
, or in your devbox.json
:
npm
. You can find other installable versions
of NodeJS by running devbox search nodejs
. You can also view the available versions on
Nixhub
Adding Yarn, NPM, or pnpm as your Node Package Manager
We recommend using Corepack to install and manage your Node Package Manager in Devbox. Corepack comes bundled with all recent Nodejs versions, and you can tell Devbox to automatically configure Corepack using a built-in plugin. When enabled, corepack binaries will be installed in your project’s.devbox
directory, and automatically added to your path.
To enable Corepack, set DEVBOX_COREPACK_ENABLED
to true
in your devbox.json
:
DEVBOX_COREPACK_ENABLED
variable from your devbox.json
Yarn
Example Repopnpm
Example RepoInstalling Global Packages
In some situations, you may want to install packages usingnpm install --global
. This will fail in
Devbox since the Nix Store is immutable.
You can instead install these global packages by adding them to the list of packages in your
devbox.json
. For example: to add yalc
and pm2
: