node.js - Node Application Heroku Application Error -


i using heroku/nodejs build pack.

this how scripts in package.json like:

"scripts": {   "build": "webpack --config webpack.prod.js",   "server": "http-server public -p 3000 -a localhost -c 0",   "prod": "npm run build && npm run server",   "dev": "webpack-dev-server --config webpack.dev.js",   "lint": "eslint . --fix" }, 

in procfile have 1 line of code:

web: npm run prod

any ideas why seeing application error?

in regards error, think should using environment variable $port i.e. http-server public -p $port -c 0 make sure have http-server in deps , not devdeps.

this might not causing error shouldn't build on run. instead add build step postinstall npm script below.

"scripts": { "build": "webpack --config webpack.prod.js", "postinstall": "npm run build", "server": "http-server public -p $port -c 0", "prod": "npm run server", "dev": "webpack-dev-server --config webpack.dev.js", "lint": "eslint . --fix" },

this ensure build gets run on deployment , not every time node process starts.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -