Deploying angular 2 App (angular cli) to heroku Deploying angular 2 App (angular cli) to heroku heroku heroku

Deploying angular 2 App (angular cli) to heroku


looks like your heroku app instance does not have angular-cli installed.I found a way to get it installed.

In your package JSON, add preinstall command like this

"scripts": {    "start": "http-server",    "lint": "tslint \"src/**/*.ts\"",    "test": "ng test",    "pree2e": "webdriver-manager update",    "e2e": "protractor",    "preinstall": "npm install -g angular-cli",    "postinstall": "ng build && mv dist/* ."  },

This will get angular-cli installed on heroku server and you will not get ng command not found related errors.


While "git push heroku master" is going on, heroku runs the package.json file. By default, however, Heroku will only install the packages listed in the dependencies object and will ignore those in devDependencies. Since we want the application build step to take place on the server rather than on our local machine, we need to adjust the package.json file a bit.

Angular CLI apps put the @angular/cli module itself as a dev dependency, meaning that we won't be able to access any ng commands on the server. To get around this, we need to move it to dependencies.

 // package.json "dependencies": { // ...   "@angular/cli": "7.3.9", },


My problem was that I was working in another branch and heroku only was taking the progress made in the master branch