I have a project that uses express and react. I'm deploying it to heroku but after running git push, I receive an error in heroku logs. I go to the specified webpage and it says that it cannot find a buildpack. What do I do? Any help will be appreciated!
you need to go this way: Settings -> Add buildpack -> node.js
don't forget, that this is only start and you may need to add some scripts in your package.json file for heroku deployment process
Related
I have built Web application using Laravel As API and Nuxt As Front and. These 2 built desperately. When the development ongoing Its isn't an issue. Because i can run them using their own development servers. Then i have bought a VPS server for host this. Now the question in how i deploy these two apps on my VPS. Specially How i can deploy nuxt app correctly in vps. Its not static side. It is ssr app.
Essentially, you are going to need a few things:
A server (which you already have)
nginx
PM2
Node/NPM installed
The tricky part of this, is to make sure the server continues running and auto-restarts in case of a crash. PM2 solves that issue, and you can read more information on how to use it here: https://nuxtjs.org/docs/2.x/deployment/deployment-pm2
You can install it by:
npm install -g pm2
Which will install PM2 globally on your server and you'll have access to the pm2 command.
Follow the documentation above, and all you gotta do is run:
pm2 start all
This will start the Nuxt service and it will run on whichever port you've defined on your nuxt.config.js or package.json files.
Now that you've got your Nuxt instance running, you need to make sure that requests that come through the browser end up on the port that Nuxt is running on, that's achievable by using nginx's reverse proxy feature that you can read more about:
https://nuxtjs.org/docs/2.x/deployment/nginx-proxy/
That documentation provides you with an example of an nginx config file, and you shouldn't really have to change anything other than the server_name, and the proxy_pass in case you've changed the default Nuxt port from 3000 to something else.
Additionally make sure that you have allowed port 80 to be listen on your server.
I'm trying to deploy this repo
https://github.com/stepseazy/checkers/
to this website
https://stepseazy.github.io/checkers
However, I'm getting 404 errors. I also tried heroku. It does work when I serve the build locally. Not sure what's wrong. Please help!!!
You'll have to distinguish your dev environment and your production one. On dev mode, you run npm start that does things (as instructed in package.json) and act as a local server and serves you project on http://localhost:3000. You simply cannot use that in production mode on Github or Heroku.
You need to deploy the built version, running npm run build. It will create a javascript file in a dist folder. You might want, on Github, create a gh-pages branch, build this production ready file on it, create an index.html file that serves it, and commit that.
I'm no expert on Heroku but it might be a slightly similar case (run post-deploy scripts that build your app and serve it through an index.html file).
Hope that help.
I've deployed my app on Heroku and I have an express script that should wait for a post request. I need to run it separately on Heroku. When I open the console on Heroku and type:
heroku run bash node scripts/start_express.js
I get the following error:
/app/.heroku/node/bin/node: /app/.heroku/node/bin/node: cannot execute binary file
How do I use node to run my js file on Heroku?
The node buildpack for heroku will automatically look for npm start script in your package.json file. That is where you can specify which file to serve up. Check this article out for some help on node and heroku https://devcenter.heroku.com/articles/nodejs-support
Now that I have completed my MEAN app below are what I think are the stages to get the app ready for production and up and running on Heroku. Could you please advise if I've got the wrong idea as this is my first app of this kind.
1) Use Grunt to lint all Javascript files (front end)
2) Concatenate all the JS files into one file
3) Uglify the concatenated file from step 2
4) Push (dist?) to Heroku (via Git) ... but what do I push?
Will there be files in a "dist" folder at this point?
Is it this directory (and only this directory) that should be pushed to Heroku?
Note: I'm confident with Git and Heroku - I'm not sure what I need to push or indeed what a typical workflow is.
Not sure what you mean by dist, but I can explain how to push to heroku
Make sure you have a package.json with an app name (Heroku will identify it as a node app)
Go to the command line and log in using heroku login Input your details
Create a file and call it Procfile inside the file: web: node app.js
heroku create appName
cd into/your/root/project/folder
'git init'
git add .
git commit -m "commit message"
git push heroku master (Make sure you have heroku as a remote)
There is a way more in depth explanation of this here: https://devcenter.heroku.com/articles/getting-started-with-nodejs#deploy-the-app But they show it with an example app. Don't forget about the Procfile. And about the dist folder, if it's not needed for the app you don't need to add it to the commit
A regular check for the production environment is to run speed tests, seo checks, and such to get the most out of it. You may want to look into canonical links, minify css,javascript,html etc..(serverside minification as well) You can also add domains with heroku which is explained here
I downloaded the source code from getbootstrap.com and ran npm install, then grunt connect without any luck.
I see this in my terminal:
Running "connect:server" (connect) task
Started connect web server on 0.0.0.0:3000
But when I navigate over, all I see is this:
What have I missed? I feel I've missed something basic here but unsure why I'm not seeing anything at all?
In the Internet Protocol version 4 the address 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown or non applicable target.
Unfortunately,bootstrap doc is not build in grunt, you need to install Jekyll to run the web local.so you need install ruby first,and install gem second,then install jekyll,finally,use
jekyll serve
to run the local server.
watch the guide