I face an issue when in development, my laravel's environment file : .env, usually clean itself whenever I update the client-side code (*.vue files).
I'm using VueJS as client and running the run-time build/watch whenever we have some change, we can refresh the browser to see the change but usually, I don't know why it always clear the laravel .env file to a blank file. It's so annoy.
Fronend command building during the dev:
npm run dev
// or
npm run watch
// configure as
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
Who might face the same issue? Any solution or way to find-out the root cause?
Noted: In production, it's OK. (Laravel 5.8 / VueJS 2.x)
Related
I have a Laravel application with a React front-end, which is deployed into an EC2 instance with CodeDeploy-Pipeline + Github.
As I understand, the npm run prod scripts from Laravel Mix (Webpack) should minify the desired assets for production mode, which will have the desired compiled assets for live use.
Since my ec2-deployment will be automatically updated after every commit to master, and supposing that I'm not including my compiled assets from npm run dev - in my case apps.js and app.css- taking me to the loop:
Commit from dev branch to master -> npm run prod -> commit master with minified output assets.
Do I have to run "npm run prod" after every commit to the "master" branch?
Neither Laravel Mix nor Laravel docs are very clear about this or give much advice on the procedure, and in general, found little information about this topic. Are there any usual best practices/WoW for this procedure?
How to start Strapi with --inspect=0.0.0.0:9229 parameter or any other way to attach the debugger to my server?
This is how I could manage that with alpha version but server.js has been removed since beta:
package.json -> scripts
"debug": "cross-env NODE_ENV=development nodemon --inspect=0.0.0.0:9229 server.js"
Never mind,
node --inspect=0.0.0.0:9229 ./node_modules/.bin/strapi dev
does the trick.
node --inspect=0.0.0.0:9229 ~/path/to/project/node_modules/#strapi/strapi/bin/strapi develop
I'm developing project using vuejs and Laravel. everything worked fine on my laptop and when I upload code to server (Digital Ocean) at that first time.
Otherwise, when I update some Vue component in resources/components folder and upload it to server again. It's seem component is not update on the server when I refresh the browser.
my code in \ webpack.mix.js is
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
if (mix.inProduction()) {
mix.version();
}
and I try to run npm run dev or npm run prod on the server after I push the nw code on it as well. It doesn't work.
I also try to clear browser cache and reload url again, it doesn't work also.
Please give me an advice how should I do.
Regards.
Well its not a good idea to upload a laravel/vuejs project at shared hosting. Although doing such process can save your life.
Run php artisan serve view:clear
Do changes at your local file and then npm run watch.
after uploading all the changes to server, always replace public/css/app.css & public/js/app.js files.
I'm trying to deploy a single page html/css/js site that was built using a bootstrap template to Heroku and continue to get an application error. I've tried some of the hacks I've found online but continue to fail with
npm ERR! missing script: start
as well as, here is the most recent log. Can anyone help?
You need to add in the root of your files, file with name Procfile
and there add this line:
web: node [app.js]
or just add to your package.json file in the scripts this line:
"scripts": {
"start": "node [app.js]"
}
where app.js is the server start file.
I'm trying to deploy an application through Heroku which is just an index.html page with some javascript and css.
I've connected my Github repository to it as a deployment method, but it never seems to work.
Every time I type "heroku logs", it spits back out:
"npm ERR! missing script: start" first.
From what I've searched, it tells me that I need to add "start": "somefile.js" as a starting point in package.json, but this is a very simple index.html page with javascript invoked from whenever a couple buttons are pressed.
How am I meant to get past this?
Heroku isn't really built for hosting static websites that have no dynamic server backend. If you want to do that, you should look into using a proper static file host like Amazon S3, Netlify, etc.
However -- if you DO want to do this on Heroku, you can do so by creating a really simple application (here's an article which shows you how to do it using Ruby): https://devcenter.heroku.com/articles/static-sites-ruby
Agree with #rdegges, you need some sort of http server. A basic node http server is pretty trivial to implement as well.
A full tutorial is available, but the keys steps are:
Make sure you have [node, npm, heroku CLI] installed.
In the root of your project directory, run npm init - (this will create a package.json in your root project directory)
Run npm install --save express - (this will add express as a dependency to the package.json file)
Create a file named Procfile in the root directory.
(contents: web: npm app.js)
Create a file named app.js in the root directory. (contents below)
Commit your changes, push to Heroku - git push heroku master
That should do it. Make sure all your files are in a directory called public as specified in the app.js file or change that to reflect where they actually are.
app.js:
var express = require('express');
var app = express();
app.use('/', express.static('public'));
app.listen(process.env.PORT || 8080);
Full Tutorial: https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction