Laravel Herd

Documentation for macOS

Manage Node.js versions

#
Managing Node.js versions

Herd ships with nvm, the Node version manager, and allows the management of multiple Node.js versions on your machine. By default, Herd automatically installs the latest available version of Node.js for you.

If you are already using nvm on your machine, Herd will not install it again, but use your existing version instead.

#
Via the GUI

You may install and update the Node.js versions on your machine via the Herd GUI. Simply click on the button and Herd will take care of the rest.

#
Via the CLI

You can use nvm on your command line to install, update and switch between Node.js versions any time. To switch to a different version, simply enter nvm use VERSION and nvm runs all required commands to change the version and make it accessible in your terminal. For more information about nvm, take a look at the official nvm documentation.

Commands that you might use regularly

# Install node 20
nvm install 20
 
# Uninstall node 20
nvm uninstall 20
 
# Switch to node 20
nvm use 20
 
## Display all commands
nvm help

#
Per-site Node versions

By default, the Node version available via CLI will be the most recent one.

However, if you need to support different Node.js versions for different sites, you may use the isolated Node functionality. This configures Herd to use the specified Node version for the site, regardless of the global Node version.

If you use ZSH, Herd will automatically detect the Node.js version to use when changing directories via your terminal.

#
Via the CLI

You may use the herd isolate-node command to specify which Node.js version a particular folder should use. The isolate-node command configures Herd/nvm to use the specified Node.js version for the site located in your current working directory:

cd ~/Herd/example-site
 
herd isolate-node 21

If your site name does not match the name of the directory that contains it, you may specify the site name using the --site option:

herd isolate-node 21 --site="site-name"

You can be as specific as you want, when isolating Node.js versions:

herd isolate-node 16.13.2

You may execute the isolated-node command to display a list of all of your isolated sites and their Node.js versions:

herd isolated-node

To revert a site back to the globally installed Node.js version, you may invoke the unisolate-node command from the site's root directory:

herd unisolate-node

#
Troubleshooting

Herd parses command output to determine your current Node.js version. If it can't parse the output because there is output that it doesn't understand, or you are using an unsupported shell, it displays Unknown for your node version in the sites list. Herd is an opinionated development environment that relies on bash or zsh and other shells lead to errors.