npm run dev with Nodejs only?

Toumaniere picture Toumaniere · Dec 21, 2017 · Viewed 18k times · Source

I develop my website on my computer with Laravel and VueJS. On my computer I can run npm run dev without problems.

When I commit to Github my website, there is a webhook that runs a script on my hosting to update the real website (on OVH).

My hosting his is a shared hosting (OVH) with SSH access, there is NodeJS available but not NPM.

How could I run npm run dev from my shared hosting ? Is there a way to run this with NodeJS ?

Thanks.

Answer

LeGEC picture LeGEC · Apr 30, 2020

You can try to install npm locally, rather than system wide.

NVM (https://github.com/nvm-sh/nvm), for example, seems to do the job (disclaimer : I haven't used it yet, I am just looking for a way to set up node/npm without changing my system wide version).

This specific tool will install node and npm somewhere in your $HOME, and additionally tinker your .bashrc so that commands like node and npm point to the correct scripts or wrappers.

If you have several users on your hosted server, you should make sure that these wrappers are used for your other users too.