node.js - How to deploy an npm project to Heroku? -


i have npm project built vue-cli , socket.io server.

this how project structured:

project/ |--node_server/ | |--server.js |--src/ | |--main.js | |--app.vue | |--other .vue files , folders

i not know how deploy app on heroku because need run 2 scripts while deploying node server.js (in node_server folder) , npm run build or npm run dev (in root folder).

what steps on how deploy successfully? heroku takes project github whenever push , builds automatically. have tried deploying ends error page.

let's need build front-end build script first, , need run nodejs server start script node server.js.

  ...   "scripts": {     "build": "gulp or idk"     "prestart": "npm run build",     "start": "node node_server/server.js",   },   ... 

but if need run these 2 scripts @ same time can achieve that:

  ...   "scripts": {     "build": "gulp or idk"     "start": "npm run build & node node_server/server.js",   },   ... 

i hope helpful.

for example, can take @ package.json of 1 of project: https://github.com/hisener/pirate-radio/blob/master/package.json

for more information, please refer https://docs.npmjs.com/misc/scripts


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -