Member-only story
How to add a new Node.Js Version to Plesk
We recently needed to install a new version of Node.Js on our Server with Plesk installed.
There is a workaround from Plesk how to do it manually but it isn’t entirely complete.
From https://support.plesk.com/hc/en-us/articles/115001630174-Node-js-versions-available-in-Plesk:
- Connect to server via ssh
- # curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
- Restart SSH connection
- # nvm install 14
- # cp -R ~/.nvm/versions/node/v14.17.0/ /opt/plesk/node/
- # plesk sbin nodemng register /opt/plesk/node/v14.17.0/bin/node
- Log in to Plesk and go to Extensions > Node.js.
- Click Refresh
Now you can see the new Node version. But if you try to use it and hit the npm install button you get “/usr/bin/env: ‘node’: No such file or directory plesk node 14”
To fix this you have to do the following (via https://stackoverflow.com/a/61893861/2689455):
Open file /opt/plesk/node/YOURVERSION/lib/node_modules/npm/bin/npm-cli.js
Change first line to #!/opt/plesk/node/YOURVERSION/bin/node
Now everything should work fine.