質問編集履歴

1

コードとエラーの詳細

2021/04/24 00:58

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,20 +1,184 @@
1
+ ## コード
2
+
1
3
  ```node.js
2
4
 
3
- // インポート
5
+ const express = require("express");
4
6
 
7
+ const { Client } = require("discord.js");
8
+
9
+
10
+
11
+ require("./Modules/Console.js");
12
+
13
+ const time = require("./Modules/Time.js");
14
+
15
+ const bot = require("./Modules/Bot.js");
16
+
5
- const hogehoge = require("./Modules/hogehoge.js");
17
+ const logger = require("./Modules/Logger.js");
18
+
19
+ const activity = require("./Modules/Activity.js");
20
+
21
+ const statistics = require("./Modules/Statistics/index.js");
6
22
 
7
23
  ```
8
24
 
9
- こんな感じパスを指定して`require`しているのですが、herokuでデプロイすると
25
+ こんな感じパスを指定して`require`しているのですが、herokuでデプロイするとモジュールが見つかりませんとエラーが出ます。
26
+
27
+
28
+
29
+ ## エラー内容
10
30
 
11
31
  ```console
12
32
 
13
- Error: Cannot find module './Modules/hogehoge.js'
33
+ > heroku logs --tail
14
34
 
15
- 2021-04-22T10:57:42.079284+00:00 app[web.1]: Require stack:
35
+ (略)
16
36
 
37
+ 2021-04-24T00:46:07.173782+00:00 heroku[web.1]: State changed from crashed to starting
38
+
39
+ 2021-04-24T00:46:11.226086+00:00 heroku[web.1]: Starting process with command `npm start`
40
+
41
+ 2021-04-24T00:46:13.128495+00:00 app[web.1]:
42
+
43
+ 2021-04-24T00:46:13.128516+00:00 app[web.1]: > <アプリ名>@1.0.0 start /app
44
+
45
+ 2021-04-24T00:46:13.128516+00:00 app[web.1]: > node server.js
46
+
47
+ 2021-04-24T00:46:13.128517+00:00 app[web.1]:
48
+
49
+ 2021-04-24T00:46:13.318618+00:00 app[web.1]: internal/modules/cjs/loader.js:883
50
+
51
+ 2021-04-24T00:46:13.318619+00:00 app[web.1]: throw err;
52
+
53
+ 2021-04-24T00:46:13.318619+00:00 app[web.1]: ^
54
+
55
+ 2021-04-24T00:46:13.318620+00:00 app[web.1]:
56
+
57
+ 2021-04-24T00:46:13.318620+00:00 app[web.1]: Error: Cannot find module './Modules/Console.js'
58
+
59
+ 2021-04-24T00:46:13.318620+00:00 app[web.1]: Require stack:
60
+
61
+ 2021-04-24T00:46:13.318621+00:00 app[web.1]: - /app/server.js
62
+
63
+ 2021-04-24T00:46:13.318621+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
64
+
65
+ 2021-04-24T00:46:13.318622+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:725:27)
66
+
67
+ 2021-04-24T00:46:13.318622+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:952:19)
68
+
69
+ 2021-04-24T00:46:13.318622+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:88:18)
70
+
71
+ 2021-04-24T00:46:13.318622+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:5:1)
72
+
73
+ 2021-04-24T00:46:13.318623+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1063:30)
74
+
75
+ 2021-04-24T00:46:13.318623+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
76
+
77
+ 2021-04-24T00:46:13.318623+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:928:32)
78
+
79
+ 2021-04-24T00:46:13.318623+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:769:14)
80
+
81
+ 2021-04-24T00:46:13.318624+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
82
+
83
+ 2021-04-24T00:46:13.318624+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
84
+
85
+ 2021-04-24T00:46:13.318624+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
86
+
87
+ 2021-04-24T00:46:13.318624+00:00 app[web.1]: }
88
+
89
+ 2021-04-24T00:46:13.326122+00:00 app[web.1]: npm ERR! code ELIFECYCLE
90
+
91
+ 2021-04-24T00:46:13.326316+00:00 app[web.1]: npm ERR! errno 1
92
+
93
+ 2021-04-24T00:46:13.329035+00:00 app[web.1]: npm ERR! <アプリ名>@1.0.0 start: `node server.js`
94
+
95
+ 2021-04-24T00:46:13.329086+00:00 app[web.1]: npm ERR! Exit status 1
96
+
97
+ 2021-04-24T00:46:13.329138+00:00 app[web.1]: npm ERR!
98
+
99
+ 2021-04-24T00:46:13.329185+00:00 app[web.1]: npm ERR! Failed at the <アプリ名>@1.0.0 start script.
100
+
101
+ 2021-04-24T00:46:13.329217+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
102
+
103
+ 2021-04-24T00:46:13.331719+00:00 app[web.1]:
104
+
105
+ 2021-04-24T00:46:13.331803+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
106
+
107
+ 2021-04-24T00:46:13.331840+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-04-24T00_46_13_329Z-debug.log
108
+
109
+ 2021-04-24T00:46:13.391747+00:00 heroku[web.1]: Process exited with status 1
110
+
111
+ 2021-04-24T00:46:13.451263+00:00 heroku[web.1]: State changed from starting to crashed
112
+
113
+ 2021-04-24T00:46:13.455899+00:00 heroku[web.1]: State changed from crashed to starting
114
+
115
+ 2021-04-24T00:46:15.000000+00:00 app[api]: Build succeeded
116
+
117
+ 2021-04-24T00:46:17.394696+00:00 heroku[web.1]: Starting process with command `npm start`
118
+
119
+ 2021-04-24T00:46:19.481988+00:00 app[web.1]:
120
+
121
+ 2021-04-24T00:46:19.481999+00:00 app[web.1]: > <アプリ名>@1.0.0 start /app
122
+
123
+ 2021-04-24T00:46:19.482000+00:00 app[web.1]: > node server.js
124
+
125
+ 2021-04-24T00:46:19.482000+00:00 app[web.1]:
126
+
127
+ 2021-04-24T00:46:19.660277+00:00 app[web.1]: internal/modules/cjs/loader.js:883
128
+
129
+ 2021-04-24T00:46:19.660278+00:00 app[web.1]: throw err;
130
+
131
+ 2021-04-24T00:46:19.660279+00:00 app[web.1]: ^
132
+
133
+ 2021-04-24T00:46:19.660279+00:00 app[web.1]:
134
+
135
+ 2021-04-24T00:46:19.660280+00:00 app[web.1]: Error: Cannot find module './Modules/Console.js'
136
+
137
+ 2021-04-24T00:46:19.660280+00:00 app[web.1]: Require stack:
138
+
17
- 2021-04-22T10:57:42.079289+00:00 app[web.1]: - /app/server.js
139
+ 2021-04-24T00:46:19.660280+00:00 app[web.1]: - /app/server.js
140
+
141
+ 2021-04-24T00:46:19.660281+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
142
+
143
+ 2021-04-24T00:46:19.660281+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:725:27)
144
+
145
+ 2021-04-24T00:46:19.660281+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:952:19)
146
+
147
+ 2021-04-24T00:46:19.660284+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:88:18)
148
+
149
+ 2021-04-24T00:46:19.660285+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:5:1)
150
+
151
+ 2021-04-24T00:46:19.660285+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1063:30)
152
+
153
+ 2021-04-24T00:46:19.660285+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
154
+
155
+ 2021-04-24T00:46:19.660285+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:928:32)
156
+
157
+ 2021-04-24T00:46:19.660286+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:769:14)
158
+
159
+ 2021-04-24T00:46:19.660286+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
160
+
161
+ 2021-04-24T00:46:19.660286+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
162
+
163
+ 2021-04-24T00:46:19.660286+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
164
+
165
+ 2021-04-24T00:46:19.660286+00:00 app[web.1]: }
166
+
167
+ 2021-04-24T00:46:19.668100+00:00 app[web.1]: npm ERR! code ELIFECYCLE
168
+
169
+ 2021-04-24T00:46:19.668288+00:00 app[web.1]: npm ERR! errno 1
170
+
171
+ 2021-04-24T00:46:19.670837+00:00 app[web.1]: npm ERR! <アプリ名>@1.0.0 start: `node server.js`
172
+
173
+ 2021-04-24T00:46:19.670889+00:00 app[web.1]: npm ERR! Exit status 1
174
+
175
+ 2021-04-24T00:46:19.670960+00:00 app[web.1]: npm ERR!
176
+
177
+ 2021-04-24T00:46:19.671005+00:00 app[web.1]: npm ERR! Failed at the <アプリ名>@1.0.0 start script.
178
+
179
+ 2021-04-24T00:46:19.671047+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
180
+
181
+ (略)
18
182
 
19
183
  ```
20
184