I'm trying to deploy a loopback 4 app into heroku. But after publishing it npm-start command not working in heroku console. its throwing sh: 1: lb-tsc not found. package.json is as follows
"devDependencies": {
"@loopback/build": "^3.0.0",
"@loopback/eslint-config": "^5.0.0",
"@loopback/testlab": "^1.10.0",
"@types/node": "^10.17.6",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
"eslint": "^6.7.2",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-eslint-plugin": "^2.1.0",
"eslint-plugin-mocha": "^6.2.2",
"source-map-support": "^0.5.16",
"typescript": "~3.7.3"},
"scripts": {
"build": "lb-tsc",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean dist *.tsbuildinfo",
.......
"lb-tsc": "lb-tsc",
"postinstall": "npm run lb-tsc"
}
When heroku runs node application the value of process.env.NODE_ENV is "production" you may check it from heroku terminal bash by typing node and then process.env And this means that dev dependencies are not resolved.
Below steps work fine to me
Another Solution: After pushing files to heroku using git push heroku master go to heroku terminal from https://dashboard.heroku.com/ and start console and then run command node dist/index.js so this command will start loopBack application make sure dist folder is available.