Reputation: 1414
Last time i manage to deploy my app using this guide Angular CLI Deployment: Host Your Angular 2 App on Heroku
But today im trying to deploy another, i got build success but the
ng build
are note run or execute.
My package.json
{
"name": "management",
"version": "1.0.0",
"engines": {
"node": "6.11.0"
},
"license": "MIT",
"scripts": {
"ng": "ng",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"start": "node server.js",
"postinstall": "ng build --aot -prod"
},
"private": true,
"dependencies": {
"@angular/compiler": "^4.0.0",
"@angular/cli": "1.2.0",
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"express": "^4.15.3",
"mydatepicker": "^2.0.21",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/language-service": "^4.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.0.1",
"firebase": "^4.1.3",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"mydatepicker": "^2.0.22",
"protractor": "~5.1.2",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
}
}
Build Log
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 6.x via semver.io...
Downloading and installing node 6.11.1...
Using default npm version: 3.10.10
-----> Restoring cache
Skipping cache restore (new-signature)
-----> Building dependencies
Installing node modules (package.json)
[email protected] /tmp/build_227ca2ee7a02142343394d7a791c62f6
├─┬ @angular/[email protected]
│ └── [email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
└── [email protected]
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 23.1M
-----> Launching...
Released v3
https://stormy-beach-92848.herokuapp.com/ deployed to Heroku
Upvotes: 2
Views: 289
Reputation: 1306
I've running into similar issues when trying to deploy my Angular + Express projects to Heroku.
From the looks of your package.json you are missing a pre-build script that will install the Angular-cli on the Heroku server so it can then run the NG commands.
Try adding "preinstall": "npm install -g @angular/cli" to "scripts"
"scripts": {
"ng": "ng",
"start": "ng build && node app.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"preinstall": "npm install -g @angular/cli",
"postinstall": "ng build --prod"
}
I just created an Angular + Express starter repo that's already configured for Heroku deployment. Feel free to give it a try and let me know!
https://github.com/pabloruiz55/Angular-Express-Heroku
Upvotes: 1