2016-12-30 12 views
-3

Angular 2/Node.jsプロジェクトをHerokuにデプロイしようとしていますが、何か間違っています。問題は私のpackage.jsonまたはangular-cli.jsonファイルにあると考えられます。それはローカルで正常に動作し、ただHerokuと一緒には生きていません。私はルートに自分のサーバーフォルダを持っています。以下は私のpackage.jsonとangular-cli.jsonとserver.jsファイルです。 Herokuのログは終わりです。事前に多くの感謝!展開:Herokuへの角2/Node.jsアプリ

package.json:

{ 
    "name": "piano2", 
    "version": "0.0.0", 
    "license": "MIT", 
    "angular-cli": {}, 
    "scripts": { 
    "start": "node server/server.js", 
    "lint": "tslint \"src/**/*.ts\"", 
    "test": "ng test", 
    "pree2e": "webdriver-manager update", 
    "e2e": "protractor", 
    "postinstall": "ng build && mv dist/* ." 
    }, 
    "engine": { 
    "node": "6.5.0" 
    }, 
    "private": true, 
    "dependencies": { 
    "@angular/common": "~2.1.0", 
    "@angular/compiler": "~2.1.0", 
    "@angular/core": "~2.1.0", 
    "@angular/forms": "~2.1.0", 
    "@angular/http": "~2.1.0", 
    "@angular/platform-browser": "~2.1.0", 
    "@angular/platform-browser-dynamic": "~2.1.0", 
    "@angular/router": "~3.1.0", 
    "body-parser": "^1.15.2", 
    "core-js": "^2.4.1", 
    "express": "^4.14.0", 
    "mongodb": "^2.2.16", 
    "mongoose": "^4.7.2", 
    "rxjs": "5.0.0-beta.12", 
    "ts-helpers": "^1.1.1", 
    "zone.js": "^0.6.23", 
    "@types/jasmine": "^2.2.30", 
    "@types/node": "^6.0.42", 
    "angular-cli": "1.0.0-beta.19-3", 
    "codelyzer": "1.0.0-beta.1", 
    "jasmine-core": "2.4.1", 
    "jasmine-spec-reporter": "2.5.0", 
    "karma": "1.2.0", 
    "karma-chrome-launcher": "^2.0.0", 
    "karma-cli": "^1.0.1", 
    "karma-jasmine": "^1.0.2", 
    "karma-remap-istanbul": "^0.2.1", 
    "protractor": "4.0.9", 
    "ts-node": "1.2.1", 
    "tslint": "3.13.0", 
    "typescript": "~2.0.3", 
    "webdriver-manager": "10.2.5" 
    }, 
    "devDependencies": { 
    } 
} 

angular-cli.json: 
    { 
    "project": { 
    "version": "1.0.0-beta.19-3", 
    "name": "piano2" 
    }, 
    "apps": [ 
    { 
     "root": "src", 
     "outDir": "dist", 
     "assets": [ 
     "./assets/images" 
     ], 
     "index": "index.html", 
     "main": "main.ts", 
     "test": "test.ts", 
     "tsconfig": "tsconfig.json", 
     "prefix": "app", 
     "mobile": false, 
     "styles": [ 
      "styles.scss" 
     ], 
     "scripts": [], 
     "environments": { 
     "source": "environments/environment.ts", 
     "dev": "environments/environment.ts", 
     "prod": "environments/environment.prod.ts" 
     } 
    } 
    ], 
    "addons": [], 
    "packages": [], 
    "e2e": { 
    "protractor": { 
     "config": "./protractor.conf.js" 
    } 
    }, 
    "test": { 
    "karma": { 
     "config": "./karma.conf.js" 
    } 
    }, 
    "defaults": { 
    "styleExt": "scss", 
    "prefixInterfaces": false, 
    "inline": { 
     "style": false, 
     "template": false 
    }, 
    "spec": { 
     "class": false, 
     "component": true, 
     "directive": true, 
     "module": false, 
     "pipe": true, 
     "service": true 
    } 
    } 
} 

server.js:

const express = require('express'); 
const bodyParser = require('body-parser'); 

const app = express(); 

const http = require('http').createServer(app); 
const port = process.env.PORT || 3030; 

app.use(bodyParser.urlencoded({extended: true})); 
app.use(bodyParser.json()); 
app.use(express.static(__dirname + '/../dist')); 


//get all students on waitlist - test 
app.get('/waitlist', (req, res) => { 
    res.status(200).send('waitlist route working'); 
}); 


http.listen(port,() => { 
    console.log(`started on port ${port}`); 
}); 

Herokuのログ:

bash-3.2$ heroku logs 
2016-12-29T22:49:49.839948+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-12-29T22:49:52.904836+00:00 app[web.1]: 
2016-12-29T22:49:52.904858+00:00 app[web.1]: > [email protected] start /app 
2016-12-29T22:49:52.904859+00:00 app[web.1]: > http-server 
2016-12-29T22:49:52.904860+00:00 app[web.1]: 
2016-12-29T22:49:53.226846+00:00 app[web.1]: Available on: 
2016-12-29T22:49:53.226834+00:00 app[web.1]: Starting up http-server, serving ./ 
2016-12-29T22:49:53.226848+00:00 app[web.1]: http://127.0.0.1:15433 
2016-12-29T22:49:53.226849+00:00 app[web.1]: http://172.16.115.150:15433 
2016-12-29T22:49:53.226850+00:00 app[web.1]: Hit CTRL-C to stop the server 
2016-12-29T22:49:53.614986+00:00 heroku[web.1]: State changed from starting to up 
2016-12-29T22:49:55.144999+00:00 app[web.1]: [Thu Dec 29 2016 22:49:55 GMT+0000 (UTC)] "GET /" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrom 
e/55.0.2883.95 Safari/537.36" 
2016-12-29T22:49:55.328593+00:00 app[web.1]: [Thu Dec 29 2016 22:49:55 GMT+0000 (UTC)] "GET /inline.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gec 
ko) Chrome/55.0.2883.95 Safari/537.36" 
2016-12-29T22:49:55.392442+00:00 app[web.1]: [Thu Dec 29 2016 22:49:55 GMT+0000 (UTC)] "GET /styles.bundle.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, l 
ike Gecko) Chrome/55.0.2883.95 Safari/537.36" 
2016-12-29T22:49:55.142604+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=7017f21f-99fb-4053-aab1-ed878745a021 fwd="204.132.140.130" dyno=web.1 
connect=1ms service=30ms status=200 bytes=2226 
2016-12-29T22:49:55.369789+00:00 heroku[router]: at=info method=GET path="/styles.bundle.js" host=traciepiano.herokuapp.com request_id=616a85d9-ecbf-470f-ae16-35725312f415 fwd="204.132.140 
.130" dyno=web.1 connect=1ms service=4ms status=200 bytes=22737 
2016-12-29T22:49:55.466759+00:00 heroku[router]: at=info method=GET path="/main.bundle.js" host=traciepiano.herokuapp.com request_id=39ddd13d-5f8d-4c4f-a7c3-04678a87b5c9 fwd="204.132.140.1 
30" dyno=web.1 connect=1ms service=58ms status=200 bytes=2798476 
2016-12-29T22:49:55.308084+00:00 heroku[router]: at=info method=GET path="/inline.js" host=traciepiano.herokuapp.com request_id=508c14b8-c00d-45e7-ba0a-d1940cc33243 fwd="204.132.140.130" d 
yno=web.1 connect=1ms service=13ms status=200 bytes=5831 
2016-12-29T22:49:55.424457+00:00 app[web.1]: [Thu Dec 29 2016 22:49:55 GMT+0000 (UTC)] "GET /main.bundle.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, lik 
e Gecko) Chrome/55.0.2883.95 Safari/537.36" 
2016-12-29T22:49:57.180413+00:00 heroku[router]: at=info method=GET path="/assets/images/dusk-piano.jpg" host=traciepiano.herokuapp.com request_id=a9ffd3e0-a951-4329-9dc6-56419d71a417 fwd= 
"204.132.140.130" dyno=web.1 connect=1ms service=8ms status=200 bytes=98477 
2016-12-29T22:49:57.188682+00:00 app[web.1]: [Thu Dec 29 2016 22:49:57 GMT+0000 (UTC)] "GET /assets/images/dusk-piano.jpg" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537. 
36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36" 
2016-12-29T22:49:57.197010+00:00 app[web.1]: [Thu Dec 29 2016 22:49:57 GMT+0000 (UTC)] "GET /assets/images/piano-beginner.jpg" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/ 
537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36" 
2016-12-29T22:49:57.194711+00:00 app[web.1]: [Thu Dec 29 2016 22:49:57 GMT+0000 (UTC)] "GET /assets/images/treble-note.png" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537 
.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36" 
2016-12-29T22:49:57.307412+00:00 app[web.1]: [Thu Dec 29 2016 22:49:57 GMT+0000 (UTC)] "GET /assets/images/kid-piano.jpg" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.3 
6 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36" 
2016-12-29T22:49:57.224217+00:00 heroku[router]: at=info method=GET path="/assets/images/piano-beginner.jpg" host=traciepiano.herokuapp.com request_id=cd8fee87-8190-4c95-9821-3c50e0768b56 
fwd="204.132.140.130" dyno=web.1 connect=1ms service=58ms status=200 bytes=2270976 
2016-12-29T22:49:57.172989+00:00 heroku[router]: at=info method=GET path="/assets/images/treble-note.png" host=traciepiano.herokuapp.com request_id=334475f2-6114-42ff-ad5e-d04222215a64 fwd 
="204.132.140.130" dyno=web.1 connect=0ms service=7ms status=200 bytes=16193 
2016-12-29T22:49:57.285909+00:00 heroku[router]: at=info method=GET path="/assets/images/kid-piano.jpg" host=traciepiano.herokuapp.com request_id=1e608f8d-45ac-4223-bc8d-a655beb61449 fwd=" 
204.132.140.130" dyno=web.1 connect=1ms service=7ms status=200 bytes=46045 
2016-12-29T22:49:57.973560+00:00 heroku[router]: at=info method=GET path="/assets/images/note-favicon.ico" host=traciepiano.herokuapp.com request_id=97c91b91-bbdb-40aa-8bab-252ee288dd64 fw 
d="204.132.140.130" dyno=web.1 connect=1ms service=3ms status=200 bytes=1695 
2016-12-29T22:49:57.998953+00:00 app[web.1]: [Thu Dec 29 2016 22:49:57 GMT+0000 (UTC)] "GET /assets/images/note-favicon.ico" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/53 
7.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36" 
2016-12-29T23:24:40.519015+00:00 heroku[web.1]: Idling 
2016-12-29T23:24:40.519512+00:00 heroku[web.1]: State changed from up to down 
2016-12-29T23:24:41.379414+00:00 heroku[web.1]: Stopping all processes with SIGTERM 
2016-12-29T23:24:41.391949+00:00 app[web.1]: http-server stopped. 
2016-12-29T23:24:41.543841+00:00 heroku[web.1]: Process exited with status 143 
2016-12-30T00:09:05.078222+00:00 heroku[slug-compiler]: Slug compilation started 
2016-12-30T00:09:05.078228+00:00 heroku[slug-compiler]: Slug compilation finished 
2016-12-30T00:09:04.907892+00:00 app[api]: Deploy 8dbda8a by user [email protected] 
2016-12-30T00:09:04.907892+00:00 app[api]: Release v8 created by user [email protected] 
2016-12-30T00:09:05.354258+00:00 heroku[web.1]: State changed from down to starting 
2016-12-30T00:09:12.278511+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-12-30T00:09:14.011452+00:00 app[web.1]: 
2016-12-30T00:09:14.011475+00:00 app[web.1]: > [email protected] start /app 
2016-12-30T00:09:14.011476+00:00 app[web.1]: > node server/server.js 
2016-12-30T00:09:14.011476+00:00 app[web.1]: 
2016-12-30T00:09:14.212414+00:00 app[web.1]: started on port 56212 
2016-12-30T00:09:14.416955+00:00 heroku[web.1]: State changed from starting to up 
2016-12-30T00:09:15.703752+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=80742a47-d64f-467c-910c-01915b32ff90 fwd="204.132.140.130" dyno=web.1 
connect=1ms service=19ms status=404 bytes=211 
2016-12-30T00:09:16.106028+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=traciepiano.herokuapp.com request_id=237ecc1c-478f-4699-a0a5-831140d6ed19 fwd="204.132.140.130" 
dyno=web.1 connect=2ms service=5ms status=404 bytes=222 
2016-12-30T00:09:30.202382+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=5f7aaac6-3e33-4bf9-a8ae-3901f7cc711c fwd="204.132.140.130" dyno=web.1 
connect=1ms service=2ms status=404 bytes=211 
2016-12-30T00:09:38.178451+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=6ca72f6a-aeec-452b-871b-63aadd8614ed fwd="204.132.140.130" dyno=web.1 
connect=1ms service=2ms status=404 bytes=211 
2016-12-30T00:09:50.129037+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=69494ed8-6845-4f2d-b173-c8ec11b7052c fwd="204.132.140.130" dyno=web.1 
connect=1ms service=3ms status=404 bytes=211 
2016-12-30T00:09:59.364675+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=e5e4f7a4-288c-42c6-95e6-82511d6171e0 fwd="204.132.140.130" dyno=web.1 
connect=1ms service=2ms status=404 bytes=211 
2016-12-30T00:44:16.811783+00:00 heroku[web.1]: Idling 
2016-12-30T00:44:16.812250+00:00 heroku[web.1]: State changed from up to down 
2016-12-30T00:44:17.284035+00:00 heroku[web.1]: Stopping all processes with SIGTERM 
2016-12-30T00:44:17.433166+00:00 heroku[web.1]: Process exited with status 143 
2016-12-30T16:15:08.162285+00:00 heroku[web.1]: Unidling 
2016-12-30T16:15:08.162637+00:00 heroku[web.1]: State changed from down to starting 
2016-12-30T16:15:17.763714+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-12-30T16:15:20.610964+00:00 app[web.1]: 
2016-12-30T16:15:20.610989+00:00 app[web.1]: > [email protected] start /app 
2016-12-30T16:15:20.610990+00:00 app[web.1]: > node server/server.js 
2016-12-30T16:15:20.610991+00:00 app[web.1]: 
2016-12-30T16:15:20.891854+00:00 app[web.1]: started on port 44891 
2016-12-30T16:15:21.365539+00:00 heroku[web.1]: State changed from starting to up 
2016-12-30T16:15:22.291276+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=df8acbc3-8ca6-40d4-ab74-a3c5ebe4de3d fwd="50.255.203.201" dyno=web.1 
connect=1ms service=23ms status=404 bytes=211 
2016-12-30T16:49:57.746673+00:00 heroku[web.1]: Idling 
2016-12-30T16:49:57.748210+00:00 heroku[web.1]: State changed from up to down 
2016-12-30T16:49:58.258963+00:00 heroku[web.1]: Stopping all processes with SIGTERM 
2016-12-30T16:49:58.465983+00:00 heroku[web.1]: Process exited with status 143 
2016-12-30T17:09:48.479604+00:00 heroku[web.1]: Unidling 
2016-12-30T17:09:48.479957+00:00 heroku[web.1]: State changed from down to starting 
2016-12-30T17:09:56.691031+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-12-30T17:09:59.474798+00:00 app[web.1]: > [email protected] start /app 
2016-12-30T17:09:59.474799+00:00 app[web.1]: > node server/server.js 
2016-12-30T17:09:59.705316+00:00 app[web.1]: started on port 31775 
2016-12-30T17:09:59.474782+00:00 app[web.1]: 
2016-12-30T17:09:59.474800+00:00 app[web.1]: 
2016-12-30T17:10:00.371115+00:00 heroku[web.1]: State changed from starting to up 
2016-12-30T17:10:02.633705+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=1d884212-7f66-48c9-a05a-8c1f2fdf6b2b fwd="204.132.140.130" dyno=web.1 
connect=0ms service=26ms status=404 bytes=211 
2016-12-30T17:10:09.372480+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=2f8ddec8-b5f4-42b6-be15-a0520fee174a fwd="204.132.140.130" dyno=web.1 
connect=0ms service=8ms status=404 bytes=211 
2016-12-30T17:10:22.856390+00:00 heroku[router]: at=info method=GET path="/" host=traciepiano.herokuapp.com request_id=6559d128-8d4a-4f47-b914-630b938f5918 fwd="204.132.140.130" dyno=web.1 
connect=0ms service=1ms status=404 bytes=211 
2016-12-30T17:13:12.537422+00:00 heroku[slug-compiler]: Slug compilation started 
2016-12-30T17:13:12.537443+00:00 heroku[slug-compiler]: Slug compilation finished 
2016-12-30T17:13:12.390345+00:00 app[api]: Deploy e9dc205 by user [email protected] 
2016-12-30T17:13:12.390345+00:00 app[api]: Release v9 created by user [email protected] 
2016-12-30T17:13:12.656303+00:00 heroku[web.1]: Restarting 
2016-12-30T17:13:12.656727+00:00 heroku[web.1]: State changed from up to starting 
2016-12-30T17:13:13.476623+00:00 heroku[web.1]: Stopping all processes with SIGTERM 
2016-12-30T17:13:13.678555+00:00 heroku[web.1]: Process exited with status 143 
2016-12-30T17:13:22.354503+00:00 heroku[web.1]: Starting process with command `npm start` 
2016-12-30T17:13:25.824094+00:00 app[web.1]: 
2016-12-30T17:13:25.824111+00:00 app[web.1]: > [email protected] start /app 
2016-12-30T17:13:25.824112+00:00 app[web.1]: > http-server 
2016-12-30T17:13:25.824113+00:00 app[web.1]: 
2016-12-30T17:13:26.012032+00:00 app[web.1]: Starting up http-server, serving ./ 
2016-12-30T17:13:26.013000+00:00 app[web.1]: http://127.0.0.1:37263 
2016-12-30T17:13:26.012052+00:00 app[web.1]: Available on: 
2016-12-30T17:13:26.013065+00:00 app[web.1]: http://172.17.170.54:37263 
2016-12-30T17:13:26.013092+00:00 app[web.1]: Hit CTRL-C to stop the server 
2016-12-30T17:13:26.747859+00:00 heroku[web.1]: State changed from starting to up 
bash-3.2$ 

とHerokuのにプッシュ:

bash-3.2$ git push heroku master 
Counting objects: 5, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (5/5), done. 
Writing objects: 100% (5/5), 482 bytes | 0 bytes/s, done. 
Total 5 (delta 4), reused 0 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Node.js app detected 
remote: 
remote: -----> Creating runtime environment 
remote: 
remote:  NPM_CONFIG_LOGLEVEL=error 
remote:  NPM_CONFIG_PRODUCTION=true 
remote:  NODE_ENV=production 
remote:  NODE_MODULES_CACHE=true 
remote: 
remote: -----> Installing binaries 
remote:  engines.node (package.json): unspecified 
remote:  engines.npm (package.json): unspecified (use default) 
remote: 
remote:  Resolving node version (latest stable) via semver.io... 
remote:  Downloading and installing node 6.9.1... 
remote:  Using default npm version: 3.10.8 
remote: 
remote: -----> Restoring cache 
remote:  Loading 2 from cacheDirectories (default): 
remote:  - node_modules 
remote:  - bower_components (not cached - skipping) 
remote: 
remote: -----> Building dependencies 
remote:  Installing node modules (package.json) 
remote: 
remote:  > [email protected] postinstall /tmp/build_a1020fae05e27a5e12c37c660bd1a34c 
remote:  > ng build && mv dist/* . 
remote: 
remote:  Could not start watchman; falling back to NodeWatcher for file system events. 
remote:  Visit http://ember-cli.com/user-guide/#watchman for more info. 
34% building modules 207/269 modules 62 active .63ms sealing 
1ms optimizing 
0ms basic module optimization 
192ms module optimization 
0ms advanced module optimization 
18ms basic chunk optimization 
0ms chunk optimization 
0ms advanced chunk optimization 
1ms module and chunk tree optimization 
141ms module reviving 
9ms module order optimization 
5ms module id optimization 
4ms chunk reviving 
1ms chunk order optimization 
13ms chunk id optimization 
rem81ms hashing 
1ms module assets processing 
182ms chunk assets processing 
3ms additional chunk assets processing 
r0ms recording 
0ms additional asset processing 
2153ms chunk asset optimization 
1914ms asset optimization 
re37ms emitting 
remote:  Hash: 30b6067cb5a200217b38 
remote:  Version: webpack 2.1.0-beta.25 
remote:  Time: 11886ms 
remote:  Asset  Size Chunks    Chunk Names 
remote:  ./assets/images/google-play-badge.png 9.89 kB   [emitted] 
remote:  main.bundle.js 2.8 MB 0, 2 [emitted] main 
remote:  inline.js 5.53 kB  2 [emitted] inline 
remote:  main.map 2.86 MB 0, 2 [emitted] main 
remote:  styles.map 28.8 kB 1, 2 [emitted] styles 
remote:  inline.map 5.59 kB  2 [emitted] inline 
remote:  index.html 1.94 kB   [emitted] 
remote:  ./assets/images/appStore.svg 12.4 kB   [emitted] 
remote:  ./assets/images/dusk-piano.jpg 98.2 kB   [emitted] 
remote:  styles.bundle.js 22.4 kB 1, 2 [emitted] styles 
remote:  ./assets/images/kid-piano.jpg 45.8 kB   [emitted] 
remote:  ./assets/images/note-favicon.ico 1.41 kB   [emitted] 
remote:  ./assets/images/one-note.svg 3.66 kB   [emitted] 
remote:  ./assets/images/piano-beginner.jpg 2.27 MB   [emitted] 
remote:  ./assets/images/play-button.png 1.46 kB   [emitted] 
remote:  ./assets/images/square_cash.png 20.7 kB   [emitted] 
remote:  ./assets/images/treble-note.png 15.9 kB   [emitted] 
remote:  ./assets/images/venmo-app.png 31.3 kB   [emitted] 
remote:  chunk {0} main.bundle.js, main.map (main) 2.26 MB {1} [initial] [rendered] 
remote:  chunk {1} styles.bundle.js, styles.map (styles) 22.1 kB {2} [initial] [rendered] 
remote:  chunk {2} inline.js, inline.map (inline) 0 bytes [entry] [rendered] 
remote:  Child html-webpack-plugin for "index.html": 
remote:  Asset  Size Chunks  Chunk Names 
remote:  index.html 4.51 kB  0 
remote:  chunk {0} index.html 2.05 kB [entry] [rendered] 
remote: 
remote: -----> Caching build 
remote:  Clearing previous node cache 
remote:  Saving 2 cacheDirectories (default): 
remote:  - node_modules 
remote:  - bower_components (nothing to cache) 
remote: 
remote: -----> Build succeeded! 
remote:  ├── @angular/[email protected] 
remote:  ├── UNMET PEER DEPENDENCY @angular/[email protected] 
remote:  ├── UNMET PEER DEPENDENCY @angular/[email protected] 
remote:  ├── @angular/[email protected] 
remote:  ├── @angular/[email protected] 
remote:  ├── @angular/[email protected] 
remote:  ├── @angular/[email protected] 
remote:  ├── @angular/[email protected] 
remote:  ├── @types/[email protected] 
remote:  ├── @types/[email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  ├── [email protected] 
remote:  └── [email protected] 
remote: 
remote: !  Unmet dependencies don't fail npm install but may cause runtime issues 
remote:  https://github.com/npm/npm/issues/7494 
remote: 
remote: -----> Discovering process types 
remote:  Procfile declares types -> web 
remote: 
remote: -----> Compressing... 
remote:  Done: 66.7M 
remote: -----> Launching... 
remote:  Released v10 
remote:  https://traciepiano.herokuapp.com/ deployed to Heroku 
remote: 
remote: Verifying deploy.... done. 
To https://git.heroku.com/traciepiano.git 
    e9dc205..14c8a1c master -> master 
bash-3.2$ 
+0

これが展開されたとき、あなたは 'Herokuののlogs'の出力を投稿することができますか?これは、コンソールによって何が出力されているかを表示します。 – rdegges

+0

あなたのserver.jsを含めてください – echonax

+0

はい、より多くのコード/ログをお願いします –

答えて

2

herokuに展開する前にpackage.jsonを変更する必要があります。

"scripts": { // ... "postinstall": "ng build --aot -prod" },

  1. ていることを確認し、インストール後は、スクリプト内の最後の要素です。

  2. 始動時 script"start": "node server.js"を追加 dependencies
  3. "angular-cli"devDependenciesを移動
  4. 最後にエンジンを追加します。今

    "engines": { "node": "6.9.2", "npm": "3.10.9" }

  5. server.jsファイルを作成します。静的ファイルのためにdistフォルダを与えてください。

  6. node modulesdistgitフォルダを削除し、新鮮なnpm installを行うserver.js

  7. を呼び出すProcfileを作成します。

  8. チェックすべての3つのコマンドng serve(localhostを:3000)、node server.js(server.jsで定義されたポート)とheroku local web(デフォルトポート:5000)とは、すべてが正常に動作している参照してください。

  9. 今すぐ導入する時間。 node modulesdistを削除し、プロジェクトをプッシュします。これらのフォルダは、herokuがpackage.jsonファイルを検索し、それに応じてnode modulesをインストールするため削除されます。そして、postinstallにはng buildが記載されているので、distフォルダも自動的に作成されます。

git init git add . git commit -m "First Deployment" git push YOURGITURL master

NOTE - すでにインストールされている、HerokuのCLIなどの表現、角度CLIを仮定。

package.json

{ 
 
    "name": "githubapp", 
 
    "version": "0.0.0", 
 
    "license": "MIT", 
 
    "angular-cli": {}, 
 
    "scripts": { 
 
    "start": "node server.js", 
 
    "lint": "tslint \"src/**/*.ts\"", 
 
    "test": "ng test", 
 
    "pree2e": "webdriver-manager update", 
 
    "e2e": "protractor", 
 
    "postinstall": "ng build --aot -prod" 
 
    }, 
 
    "private": true, 
 
    "dependencies": { 
 
    "@angular/common": "2.0.0", 
 
    "@angular/compiler": "2.0.0", 
 
    "@angular/core": "2.0.0", 
 
    "@angular/forms": "2.0.0", 
 
    "@angular/http": "2.0.0", 
 
    "@angular/platform-browser": "2.0.0", 
 
    "@angular/platform-browser-dynamic": "2.0.0", 
 
    "@angular/router": "3.0.0", 
 
    "angular-cli": "1.0.0-beta.15", 
 
    "core-js": "^2.4.1", 
 
    "express": "^4.14.0", 
 
    "rxjs": "5.0.0-beta.12", 
 
    "ts-helpers": "^1.1.1", 
 
    "zone.js": "^0.6.23" 
 
    }, 
 
    "devDependencies": { 
 
    "@types/jasmine": "^2.2.30", 
 
    "codelyzer": "~0.0.26", 
 
    "jasmine-core": "2.4.1", 
 
    "jasmine-spec-reporter": "2.5.0", 
 
    "karma": "1.2.0", 
 
    "karma-chrome-launcher": "^2.0.0", 
 
    "karma-cli": "^1.0.1", 
 
    "karma-jasmine": "^1.0.2", 
 
    "karma-remap-istanbul": "^0.2.1", 
 
    "protractor": "4.0.5", 
 
    "ts-node": "1.2.1", 
 
    "tslint": "3.13.0", 
 
    "typescript": "2.0.2" 
 
    }, 
 
    "engines": { 
 
    "node": "6.5.0", 
 
    "npm": "3.10.6" 
 
    } 
 
}

server.js

// server.js 
 
const express = require('express'); 
 
const app = express(); 
 
// Run the app by serving the static files 
 
// in the dist directory 
 
app.use(express.static(__dirname + '/dist')); 
 
// Start the app by listening on the default 
 
// Heroku port 
 
app.listen(process.env.PORT || 8080); 
 

 
const forceSSL = function() { 
 
    return function (req, res, next) { 
 
    if (req.headers['x-forwarded-proto'] !== 'https') { 
 
     return res.redirect(
 
     ['https://', req.get('Host'), req.url].join('') 
 
    ); 
 
    } 
 
    next(); 
 
    } 
 
} 
 
// Instruct the app 
 
// to use the forceSSL 
 
// middleware 
 
app.use(forceSSL());

procfile

web: node server.js

+1

私はherokuに角2のアプリを配備するために多くのチュートリアルを試しましたが、運がなかった。この回答に続いて、展開は成功しました!ありがとう! –

関連する問題