Foundation Sites deploy to Heroku - 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.

Related

Why the dist folder in .nuxt is deleted after I executed pm2 for server side rendering?

Currently I am using pm2 and nodejs on windows to deploy nuxt.js project. Below are my steps:
Build project with npm run build
Copy 【.nuxt, static, nuxt.config.js, package.json】 to a new folder call prod01
In prod01 folder, execute npm i to install dependencies and use npm run start to check if everything works fine.
Then, I config nginx, install pm2 and use pm2 start node_modules/nuxt/bin/nuxt.js --name prod01 to start my project. (I've tried a lot of pm2 commands and this works for me)
However, after I use above pm2 start command, the dist folder in .nuxt has been deleted, and all I can see on
because dist in .nuxt was not existed.
Does anyone have any ideas about how this happened? My nuxt.config setting like meta description is still there, and I can open the web pages.
Or is there any solutions except using docker, that can also do server side rendering? Or maybe I should try using docker?
Please help me, thank you!

How do I separate [npm run watch] and [npm run prod] output (Laravel Mix context)?

I am using Laravel Mix to compile my frontend assets for development environment npm run watch and npm run prod when I am ready to push changes to GIT server and deploy to live.
The problem is when I run npm run watch my changelist gets contaminated heavily (since all the assets are uncompressed, due to obvious reasons) and I have to stop npm run watch, run npm run prod, push changes run npm and run watch again....
This is quickly got old and boring... I was considering compiling production assets on production server, but this is not possible, since we are practicing zero-downtime deployment keeping live server clean from npm packages and such.
Is there a way to actually be able to run npm run watch without interruptions, maybe publish uncompressed assets somewhere else (inject from different folder with mix() on dev), compiling production assets before git commit (automatically?!)?
This would seriously help me a lot.
Any suggestions highly appreciated!
You can add public/js/* and public/css/* to gitignore and compile what you need on the server and after runs npm run watch no file will be change affected by git.

Deploy laravel app to shared host with npm dependencies

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.

How can I set up a mean stack app with mean.io which uses angular 1.4 and bower?

I want to code an app in angular 1.4 and for that I came across mean.io the best scaffolding tool presently.But when i downloaded it,i got webpack and tons of various unfamiliar stuff.Please tell me how i can download a mean.io app which uses angular 1.4 or if not then a nice scaffolding tool for angular 1.4 and steps to install it.That would be a great help !
Thanks in advance.
What you can do is head over to the Github page for the mean.io framekwork at this link Mean.io Github version 0.7.0. From there take a look at the read me and scroll follow the instructions.
You'll need to install mongo database on your machine and make sure its running each time you want to run your application. Here is a good link, follow it step by step. MongoDB install - windows
Then you will have to have the latest version of node.js installed. It can be installed here. node js download
You will also need to install the latest version of Git to your machine. It can be installed here Git download
Once the above are done, you will need to navigate to a directory on your computer using the command prompt/terminal and type the following commands. I suggest you go to C:\Users\YourName
npm install -g npm
npm update -g
npm install -g mean-cli
npm install -g bower
They will take some time so be patient.
Then type this command to clone the boilerplate code to your machine
mean init <yourAppTitle>
When that is done change directories into the project folder you just made like this
cd yourAppTitle
Then inside this folder type the following commands to install to your project
npm install
bower install
You may see some warning signs/errors and you can ignore them for now and proceed.
Finally, type this command inside your project folder - this will start your app. Remember to have mongodb running simultaneously or this will not work
gulp
Head over to your browser and type in localhost:3000
You should see the boilerplate code.
If you cannot get Mean.io working you can try installing a different angular scaffold here - angular scaffold. Read through the readme file and you will see steps to install the angular scaffold

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