質問編集履歴

1

質問の追加

2021/01/08 04:13

投稿

jasmine-jp
jasmine-jp

スコア15

test CHANGED
@@ -1 +1 @@
1
- Herokuのデプロイについて
1
+ webpack-dev-serverを使っているnodeのHerokuのデプロイ
test CHANGED
@@ -1,10 +1,250 @@
1
+ ローカル下ではnpm run serverと叩くと動くnodeを作っています。
2
+
3
+ ```package
4
+
5
+ {
6
+
7
+ "name": "npm",
8
+
9
+ "version": "1.0.0",
10
+
11
+ "description": "",
12
+
13
+ "main": "index.js",
14
+
15
+ "scripts": {
16
+
17
+ "test": "echo \"Error: no test specified\" && exit 1",
18
+
19
+ "tsc": "tsc -p .",
20
+
21
+ "tslint": "tslint -p .",
22
+
23
+ "typedoc": "typedoc -p .",
24
+
25
+ "webpack": "webpack",
26
+
27
+ "server": "webpack-dev-server"
28
+
29
+ },
30
+
31
+ "author": "",
32
+
33
+ "license": "MIT",
34
+
35
+ "devDependencies": {
36
+
37
+ "@types/pixi.js": "^5.0.0",
38
+
39
+ "ts-loader": "^8.0.3",
40
+
41
+ "tslint": "^6.1.3",
42
+
43
+ "tslint-config-airbnb": "^5.11.2",
44
+
45
+ "typedoc": "^0.19.0",
46
+
47
+ "typescript": "^4.0.2",
48
+
49
+ "webpack": "^4.44.1",
50
+
51
+ "webpack-cli": "^3.3.12",
52
+
53
+ "webpack-dev-server": "^3.11.0"
54
+
55
+ },
56
+
57
+ "dependencies": {
58
+
59
+ "pixi-sound": "^3.0.5",
60
+
61
+ "pixi.js": "^5.3.3"
62
+
63
+ }
64
+
65
+ }
66
+
67
+ ```
68
+
69
+ そのままデプロイしようとするとできなかったので
70
+
71
+ heroku set: NPM_CONFIG_PRODUCTION=false
72
+
73
+ を叩きました。
74
+
75
+ ```
76
+
77
+ remote: Compressing source files... done.
78
+
79
+ remote: Building source:
80
+
81
+ remote:
82
+
83
+ remote: -----> Node.js app detected
84
+
85
+ remote:
86
+
87
+ remote: -----> Creating runtime environment
88
+
89
+ remote:
90
+
91
+ remote: NPM_CONFIG_LOGLEVEL=error
92
+
93
+ remote: NPM_CONFIG_PRODUCTION=false
94
+
95
+ remote: NODE_ENV=production
96
+
97
+ remote: NODE_MODULES_CACHE=true
98
+
99
+ remote: NODE_VERBOSE=false
100
+
101
+ remote:
102
+
103
+ remote: -----> Installing binaries
104
+
105
+ remote: engines.node (package.json): unspecified
106
+
107
+ remote: engines.npm (package.json): unspecified (use default)
108
+
109
+ remote:
110
+
111
+ remote: Resolving node version 12.x...
112
+
113
+ remote: Downloading and installing node 12.20.1...
114
+
115
+ remote: Using default npm version: 6.14.10
116
+
117
+ remote:
118
+
119
+ remote: -----> Restoring cache
120
+
121
+ remote: - node_modules
122
+
123
+ remote:
124
+
125
+ remote: -----> Installing dependencies
126
+
127
+ remote: Installing node modules
128
+
129
+ remote:
130
+
131
+ remote: > fsevents@1.2.13 install /tmp/build_17cb6e18/node_modules/webpack-dev-server/node_modules/fsevents
132
+
133
+ remote: > node install.js
134
+
135
+ remote:
136
+
137
+ remote:
138
+
139
+ remote: Skipping 'fsevents' build as platform linux is not supported
140
+
141
+ remote:
142
+
143
+ remote: > fsevents@1.2.13 install /tmp/build_17cb6e18/node_modules/watchpack-chokidar2/node_modules/fsevents
144
+
145
+ remote: > node install.js
146
+
147
+ remote:
148
+
149
+ remote:
150
+
151
+ remote: Skipping 'fsevents' build as platform linux is not supported
152
+
153
+ remote: added 702 packages in 12.763s
154
+
155
+ remote:
156
+
157
+ remote: -----> Build
158
+
159
+ remote:
160
+
161
+ remote: -----> Caching build
162
+
163
+ remote: - node_modules
164
+
165
+ remote:
166
+
167
+ remote: -----> Pruning devDependencies
168
+
169
+ remote: Skipping because NPM_CONFIG_PRODUCTION is 'false'
170
+
171
+ remote:
172
+
173
+ remote: -----> Build succeeded!
174
+
175
+ remote: -----> Discovering process types
176
+
177
+ remote:
178
+
179
+ remote: -----> Compressing...
180
+
181
+ remote: Done: 65M
182
+
183
+ remote: -----> Launching...
184
+
185
+ remote: Released v22
186
+
187
+ ```
188
+
189
+ ビルドはうまくいきますがそのあとのデプロイがうまくいきません。
190
+
191
+ ```Procfile
192
+
193
+ web: npm run server
194
+
195
+ ```
196
+
197
+ と一応はしているのですがよくわかっていません。webpack-dev-server以外のコマンドが必要でしょうか?また、heroku-postbuildも記述しておりません。
198
+
199
+ ```
200
+
201
+ 2021-01-08T03:49:27.000000+00:00 app[api]: Build started by user hoge//以下個人情報はhogeとします
202
+
203
+ 2021-01-08T03:49:58.685602+00:00 app[api]: Deploy 8a5ba794 by user hoge
204
+
205
+ 2021-01-08T03:49:58.685602+00:00 app[api]: Release v22 created by user hoge
206
+
207
+ 2021-01-08T03:49:59.169606+00:00 heroku[web.1]: State changed from crashed to starting
208
+
209
+ 2021-01-08T03:50:03.000000+00:00 app[api]: Build succeeded
210
+
211
+ 2021-01-08T03:50:07.435947+00:00 heroku[web.1]: Starting process with command `npm run server`
212
+
213
+ 2021-01-08T03:50:11.691622+00:00 app[web.1]:
214
+
215
+ 2021-01-08T03:50:11.691722+00:00 app[web.1]: > npm@1.0.0 server /app
216
+
217
+ 2021-01-08T03:50:11.691723+00:00 app[web.1]: > webpack-dev-server
218
+
219
+ 2021-01-08T03:50:11.691723+00:00 app[web.1]:
220
+
221
+ 2021-01-08T03:50:15.277334+00:00 app[web.1]: ℹ 「wds」: Project is running at http://localhost:20755/
222
+
223
+ 2021-01-08T03:50:15.284599+00:00 app[web.1]: ℹ 「wds」: webpack output is served from /
224
+
225
+ 2021-01-08T03:50:15.284966+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from www
226
+
227
+ 2021-01-08T03:51:08.052863+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch2021-01-08T03:51:08.079921+00:00 heroku[web.1]: Stopping process with SIGKILL
228
+
229
+ 2021-01-08T03:51:08.234704+00:00 heroku[web.1]: Process exited with status 137
230
+
231
+ 2021-01-08T03:51:08.274212+00:00 heroku[web.1]: State changed from starting to crashed
232
+
233
+ 2021-01-08T03:51:09.976616+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=hoge.herokuapp.com request_id=5e1790bf-88fd-42c9-9817-b932436e7496 fwd="124.145.183.240" dyno= connect= service= status=503 bytes= protocol=https
234
+
235
+ 2021-01-08T03:51:10.240070+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=hoge.herokuapp.com request_id=de676b36-6413-4650-b49f-307357c5a70d fwd="124.145.183.240" dyno= connect= service= status=503 bytes= protocol=https
236
+
237
+ 2021-01-08T03:52:08.881651+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=hoge.herokuapp.com request_id=17036e41-c172-4929-be4f-6f59c89a267e fwd="124.145.183.240" dyno= connect= service= status=503 bytes= protocol=https
238
+
239
+ 2021-01-08T03:52:09.180226+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=hoge.herokuapp.com request_id=a4c54c66-a4c2-44cf-ba0d-47507d36aaeb fwd="124.145.183.240" dyno= connect= service= status=503 bytes= protocol=https
240
+
241
+ ```
242
+
1
243
  `Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch`
2
244
 
3
- がエラーメッセージとして出力されます。
4
-
5
- 調べたところポート番号をいじればよいとのことだったので
245
+ がエラーメッセージらしく、調べたところポート番号をいじればよいとのことだったので
6
-
246
+
7
- ```webpack
247
+ ```webpackconfig
8
248
 
9
249
  const path = require('path');
10
250
 
@@ -78,4 +318,4 @@
78
318
 
79
319
  ```
80
320
 
81
- としてみたのですが改善が見られません。どうすればよろしいでしょうか?
321
+ としているのですが改善が見られません。どうすればよろしいでしょうか?