3

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.

Toumaniere
  • 73
  • 1
  • 1
  • 5
  • ask your provider to install `npm` – Chay22 Dec 21 '17 at 11:08
  • If you just want to execute the `dev` script defined in the `package.json` file, maybe you can do something like `bash -c $(node -e 'console.log(require("./package.json").scripts.dev)')` (untested). – Decade Moon Dec 21 '17 at 11:14
  • 4
    I suppose you should not run `npm run dev` on the production server. Consider building VueJS code using `npm run build` and publishing built version to the production. – vsenko Dec 21 '17 at 11:52
  • @Toumaniere hi, do u hv a solution to this already? – yeeen Sep 17 '18 at 06:51

1 Answers1

0

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.

LeGEC
  • 46,477
  • 5
  • 57
  • 104