DEV Community

David
David

Posted on

How to use NVM in Laravel Forge

  1. SSH to forge server and run this command
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
Enter fullscreen mode Exit fullscreen mode
  1. In forge site deployment script. add this script to install and change the version
echo 'configuring nvm...';
. ~/.nvm/nvm.sh
nvm install v20.0.0
nvm use v20.0.0

echo 'Running > npm install';
npm install

echo 'Running > npm run build';
npm run build
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
xwero profile image
david duymelinck • Edited

Why would you want nvm on you server?

Nvm is a development tool which allows you to use different node version in diffferent projects or branches.

If you want a new node version on you server. Just update it as you would php.