I have a Laravel project that already deployed on shared hosting server but now I just want to add Vue.js component to that project.
Problem is when I was deploying project I didn't install the npm. Can anyone advise me how to fix this thing. I used Laravel 5.8
How can I add Vue component to this project ?
you can't run npm commands in sharing hosting .
you can run npm run production in local and share mixed file on sharing hosting
Usually shared hosting does not provide enough shell commands. So you would need to run npm run production on your local computer.
As a reminder, it is not recommedable to host Laravel website on a shared host. You may need to do extra work to make your Laravel website work such as changing document root of your laravel project.
Related
I want to deploy my Laravel App in a VPS hosting plan.
I have a WHM, but I've no experience deploying my app and configure the server.
I don't have a domain, so I want to test my app using an IP address (like DigitalOcean)
any help?
Edit:
I've completed these steps into my WHM.
Have SSH access to the VPS
Have a sudo user and set up some kind of firewall (for example ufw)
Install required software (nginx, MySQL, PHP, Composer, npm) and additional PHP modules if necessary.
I've created an account ( CPanel ) and I've completed steps
Create a database
Checkout your application using VCS like Git
Configure your .env file.
Install your composer packages, run npm, or anything you would like to do
The account ( CPanel provides an IP address that looks like http://xxx.xxx.x.xx/~cpanel-account-name/).
I can access the website correctly ( however all images are broken and even laravel-routes are not found 404). I know the issue is because ( ~cpanel-account-name/ ) found at the end of the URL.
But how can I fix It?
Since this is quite a broad topic that consists of multiple questions, perhaps you could elaborate on steps you have already taken or the step you are stuck at / need help with?
In short, you need to do the following:
Have SSH access to the VPS
Have a sudo user and set-up some kind of firewall (for example ufw)
Install required software (nginx, MySQL, PHP, Composer, npm) and additional PHP modules if necessary.
Create a database
Checkout your application using VCS like Git
Configure your .env file.
Install your composer packages, run npm or anything you would like to do
Set-up nginx
If this seems daunting, I would advice to tackle it one by one and trying to research every step along the way. This might be challenging and time-consuming, but will be very rewarding!
Alternatively, a paid solution like Laravel Forge can help you take care of server management.
I'm coming from the SPA / React world and am working on my first Nuxtjs SSR app.
When I run an npm run build I'm expecting artifacts to be created which can be copied over to my production environment that are then run using node on the server. When I do an npm run build, I get nothing in a dist folder but in ./nuxt/dist there are two folders, server and client.
Completely lost on how to proceed from there. All the online help seems to be for non production builds with the entire development folder present to run nuxt start.
How do I do a production deployment and run it using node on a server
There are several way to publish nuxt:
So, for an SPA deployment, you must do the following:
Change mode in nuxt.config.js to spa.
Run npm run build.
Deploy the created dist/ folder to your static hosting like Surge, GitHub Pages or nginx.
but I think you use universal mode (SSR) so in this mode its better to install npm or yarn in server and run this command in your production server
nuxt build
nuxt start
So if you want to copy dist folder change mode of project to SPA in nuxt.config.js
For more information read this article
How do I deploy an SSR NuxtJs app to a host
There is the same question with my answer. There you will find necessary configs, so I do not want to copy the answer here, because it is better to keep everything in one place because of possible updates.
I'm testing process of deploying app with vue components on shared server. I have access to ssh. Npm is also installed. I check it with "node -v" command. The problem is that vue compoennts are not displaying. I tried to write "npm run production" but I receive an error 126. What should I do to display vue components? I know the voices that shared hosting is not the best choice but I'm just testing. I know that it's possible to turn on vue components on this hosting. I did it long time ago but I forgot how. My process of deployment had 3 steps:
1. Copy files (wihout public_html) from local disc to shared server w
2. Copy public_html do public_html on shared server
3. Changing paths in index.php inside public_html
App is almost working. The problem is with vue components. Please help.
You don't need NodeJs in production. You just need to build it (CSS & JS) on your machine, then upload it. Run npm run production in your local machine, then the public/css/app.css and public/js/app.js will be available (depends on your configuration). Then, just upload these files, done.
I've just finished my first project with laravel.
Now when I want to go live, I suddenly discovered that my host does not allow installation of nodejs on their shard host package.
The shock the horror....
I managed to do everything on the live server, I ran npm run production on my local machine and uploaded the minified files for the css and js.
The problem is, on my shard server, I still get this vue warning:
You are running Vue in development mode. Make sure to turn on
production mode when deploying for production. See more tips at
https://vuejs.org/guide/deployment.html
but not on my local machine.
Looking at the link they refer to, I don't really understand what I need to do as I'm new to laravel, npm, node and vue.
How can I turn vue to production mode manually without npm?
Is it possible?
Yes, you can adjust this manually. If you are using the Laravel scaffolding for Laravel Mix, add the following lines to your resources/js/bootstrap.js file
Vue.config.devtools = false
Vue.config.debug = false
Vue.config.silent = true
These lines will suppress the warnings, debugging and turn off devtools, essentially the same as npm run production. This will also turn them off in your local environment, but it is probably your only solution.
I install my web site on ovh server but i think composer it not install on it.
So i have a fatal error
Class 'App\Models\Product\ProductModel' not found in /home/xxxxx/App/Controller/Home/HomeController.php on line 26
in my ftp i have
composer.json
App
bootstrap.php
Model
Product
ProductModel.php
Controller
indexController.php
Home
HomeController.php
www
index.php
I auto load App as App
Do you know if the problem is composer?
Do you know if i can use with out composer?
How?
thank you
Use Composer before you upload your code. Composer need not be executed on the server - in fact this is regarded more of a problem than a solution because it requires all package hosting servers to be up, and the command line tools for accessing version control systems be installed (at least as a fallback).
The recommended way to use Composer is to run it locally (or on a deployment machine that is local enough), let it fetch all files, create the autoloader, and then copy all the collected files to the target server.
This approach also resolves the problem with Composer requiring about 1GB of memory (or more, depending on how many packages have to be considered) when being run - if your web server has less memory installed, you won't be able to use Composer.