'How do I host Laravel and Inertiajs (React) app in cPanel?

I built a laravel with inertiajs App, Now I'm going to deploy my app to some host.

I tried Siteground to deploy it but it doesn't support NPM!

Now I'm trying to do it with cpannel, Here is my file structure: enter image description here

And I already connect SSH terminal. there is no issue with laravel installation, but when I do npm install I'm getting -bash: npm: command not found

Can you help me with some example please!



Solution 1:[1]

In production you don't need to install node modules if you have a production version of your (React app)

i usually use Reactjs in frontend so the process is

  1. yarn build
  2. take the build version of your app and add it to the root of your server

for Laravel

  1. git clone ******
  2. cp .env.example .env
  3. edit the .env data to match your production data
  4. run composer install
  5. run php artisan key:generate
  6. php artisan migrate
  7. point your server to the public folder with symbolic link for example

your app should now be live.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 M't