Deploy laravel app to shared host with npm dependencies - laravel

I am about to finally deploy my laravel app to shared host soon, using ssh. My question here is: in local enviroment I installed all npm dependencies (npm install), to compile all vue.js scripts.
What i already know is that: after uploading everything to shared host I should run "composer install" to install composer dependencies and edit .env.
But should I also run "npm install" if I already have my app.js compiled on local enviroment?
Thanks,
PS

You actually probably don't have npm on a shared server. At least with HostGator, which is where I have experience, it wasn't possible - in which case - you would need to run and compile npm locally before pushing to the server.

Yes as per my experience with Hostinger it is not possible to install NODE, and NPM via a command on the server. Because it is not a private server and it is already given us our requirements setup during server selection. So you can do this by pushing your js assets with git and pulling on the server to get js.

Related

Error on Laravel after installing VueJS. Request failed with status 404

I am developing a small system with Laravel Framework 5.6.39 and everything was going well, until I installed Vue Js. When viewing in the browser, what should be displayed does not appear and the following appears in the console:
How can I solve this error?
I think you need to run:
npm run watch
After adding VueJS to your project you need to install all dependencies by executing:
npm install
Then you can either compile your assets onetime by executing:
npm run dev
Or start a watcher which compiles your assets automatically after detecting a filechange:
npm run watch
The compile process will generate the app.js file which is missing in your case. You can read more about this process or possibilities in laravel here (laravel docs about frontend).
After pulling your project you need to install all dependencies using
npm i
Then you can build it for development one-time using
npm run dev
Or for real-time updates
npm run watch
And when your project is ready for production
npm run prod

Is moment.js available on a production server?

I have written some code that requires moment.js. It works on my local environment. Now i want to push this branch to production using laravel forge / and a git repository. I installed moment.js on my local environment using: npm install momentjs. My question is: will moment.js be available now on production server without me having to add 'npm install' to the laravel forge deployment script and adding momentjs to package.json. The reason i ask this also is because i read running 'npm install' in a deployment script is a no-no. So how do it do this properly?

Hyperledger Composer - Angular App Compile

I spun up an Ubuntu server on AWS and everything is working as expected with Hyperledger Composer except when I try to compile an angular-app using "npm start" after creating the app via "yo hyperledger-composer:angular". Its taking forever to compile at 92% chunk asset optimization. When I do the same exact steps on my local mac laptop, no issues at all. Must be some sort of version issue with something in the node_modules? Any thoughts or suggestions?
probably because your AWS VM instance is behind a proxy - ie its network interface doesn't know how to route to www and specifically to https://registry.npmjs.org/ for example as its trying to install packages when you do an npm install

Foundation Sites deploy to Heroku

I've created a site using foundation sites. It's using the standard install using the Foundation CLI.
I've got the site running locally using foundation watch. When I push this to Heroku the build succeeds in the Heroku console but when I visit the site in a browser I only get an application error.
Heroku support has said I should be using $PORT in my startup script but I don't know where to configure this. This also seems strange as it's the first install.
Has anyone had similar problems?
Here are some of the issue i find in your app.
Firstly heroku is not going to install any of your devDependencies, so make sure all dependencies required to build are in dependencies list.
Heroku searches for Procfile, which is used to launch app. If it doesnt find that, it will go with standard procedure.
In your case
It runs npm start. Which calls gulp to run build, server and watch( which is not necessary ).
Second heroku assign PORT number dynamically. But your server task binds a static port number 8000 from config.yml. So that may fail your app.
You dont need to use foundation watch in heroku as watch mode of files are not needed
You are required to run a server and server your files
My advice is to use expressJS server( because i have used it ) after your done building your app with gulp
In your start script(package.json), you can write something like
"scripts": {
"start": "gulp && node server.js",
"build": "gulp build --production"
}
where server.js is expressjs server file. here's an example how you can write it.
Hope your problem will have less issues now.
Not to say about your github repo, but here are some points that might helpfull for you as well as for your clients/users or anybody.
Why you have uploaded all node_modules and bower_components to github. When you have their respective json file, anyone can do npm install or bower install to download all required packages.
Uploading node_modules and bower_components will be a headache for you as your push and clone size increases.

Running 2 Meteor.js apps on the same computer causes error with npm packages

If I launch the first meteor project which uses npm packages via the meteor-npm package, followed by a second meteor project using the meteor-npm package, the first meteor project will suddenly have problem finding the npm packages right after the second meteor server has finished deploying:
Error: Can't find npm module 'mysql'. Did you forget to call 'Npm.depends' in package.js within the 'npm' package?
Restarting the first meteor server, the server output will show
npm: updating npm dependencies -- mysql...
And things will start working.
This problem happens everytime I have 2 meteor 0.7 servers running at the same time on the same system. Is there some problem with the setup/permissions of the npm packages?

Resources