I’m trying to deploy a Laravel app to a Jelastic Cloud. My problem is, I don’t know how to build my scripts with npm. Until now I use laravel forge & envoyer and build the scripts with npm run prod
on the server while deploying.
But How to do that in Jelastic Cloud? Do I need to add a node.js server just for the deployment process? Or is it possible to install node on the nginx server in Jelastic cloud?
(I know I could build the scripts locally before uploading, but that makes it dependant on my dev machine, which I don’t like)
2
Answers
We (Layershift) provide an add-on that installs node.js on a Jelastic PHP node for this exact reason.
Speak to your Jelastic provider, or move to one that offers this.
You can install a pre-compiled NodeJS from https://nodejs.org/en/download/, extract it to a home directory in Jelastic, and then add the new path to the PATH var accordingly. Here is a detailed flow.
Enter your php container through WebSSH or SSH and run the following commands
(Here NodeJS LTS version is used, you can replace v16.14.2 with any other preferred version).
Then you can check if it’s installed by issuing
Also instead of editing .bash_profile to add path to NodeJS, you can add $HOME/bin path via the dashboard to the PATH variable as described here