How do I host Laravel and Inertiajs (React) app in cPanel? - node.js

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:
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!

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
yarn build
take the build version of your app and add it to the root of your server
for Laravel
git clone ******
cp .env.example .env
edit the .env data to match your production data
run composer install
run php artisan key:generate
php artisan migrate
point your server to the public folder with symbolic link for example
your app should now be live.

Related

Running Vue JS project in Docker

I have already built a few VueJs applications for myself. Now I am working with a team. One backend and me frontend.
Now I'm wondering how do I include the environment in the repository. Until today I always had node on my local machine. With nvm I could also jump between versions on the local machine. But now I want future colleagues who will develop the app to have the same environment. So work with the same node and npm version. I thought this could be done with a dockerfile or docker-compose.yml. Then I can log into the container and run the npm run build for example.
Question But how does it work with npm run dev? Do I have access with the browser to the port that is assigned in the container of the Vue app?

Building and deploying production build of Node.js TypeScript server

I see many questions about how to deploy production build of Node.js app on server, but I not found any about building and deploying TypeScript server.
I am using GitHub Actions to build my TS into JS to /dist folder, but I realized that I can't just move this folder to server and start it.
I also still need to install dependencies, because it is not same as on Client-side (React for example) where all dependencies are bundled.
Are there any best practices how to automatically deploy those kinds of server apps?
Or it is simple as:
Bulding TS to JS
Moving /dist and package.json to production server
Running script on server to yarn install and launch pm2

reactjs app not run after serve and start

I just installed node.js on my centos 7 server, then install react
it successfully created my new react app, after that, I run:
npm start
and or serve -s build
but none of these run in my browser.
This site can’t be reached
how can I solve this?
If you have sever inside can you try with start debugging of your application
Stop npm, if you're using yarn
Start the project with command above, inside your project home folder
yarn start
Take some time to learn commands below:

Install React JS on Cent OS

I am very very new to React JS and have tried to install it on my VPS server that is running Cent OS.
Node.js seems to be working,
I have build a React project using the following code as a root level user on SSH:
npx create-react-app my-react-project
cd my-react-project
npm start
but when trying to view in browser I get a blank page (instead of react js default template)?
I see many people install this locally but I haven't found any examples on a hosted VPS, is this something I am doing wrong?
Any help would be much appreciated, thanks!
if you have ssh access to your VPS, the rest is pretty the same as your local environment.
You can copy/paste your project to your CentOS host and use the following commands in order to run it:
cd your_project_folder_which_includes_package_json_file
npm install
npm start
Also, if you are using this server as a production host, You should consider getting a production build of your React app on your local env by running npm run build and then publishing the build folder on your server and serving it using a static file server or using a reverse-proxy such as Nginx as a static server.
Actually this page in React documentation does a good job in explaining the details of deploying a React app, I encourage you to take a look at it.

How to install Parse Server on Heroku?

How can Parse Server be installed on Heroku using the parse-server repository and not the parse-server-example repository?
I cloned parse-server locally and was trying to modify the start script in package.json but without success. I still want to use an index.js file like in parse-serverexample to configure the server.

Resources