Heroku错误:找不到模块“ ./src/app.js”

时间:2020-06-30 17:53:59

标签: heroku

我正在部署到Heroku并出现以下错误:

2020-06-30T17:32:59.604674+00:00 heroku[web.1]: Starting process with command `node index.js`
2020-06-30T17:33:03.014063+00:00 app[web.1]: internal/modules/cjs/loader.js:969
2020-06-30T17:33:03.014083+00:00 app[web.1]: throw err;
2020-06-30T17:33:03.014083+00:00 app[web.1]: ^
2020-06-30T17:33:03.014083+00:00 app[web.1]: 
2020-06-30T17:33:03.014084+00:00 app[web.1]: Error: Cannot find module './src/app.js'
2020-06-30T17:33:03.014084+00:00 app[web.1]: Require stack:
2020-06-30T17:33:03.014085+00:00 app[web.1]: - /app/index.js
2020-06-30T17:33:03.014085+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
2020-06-30T17:33:03.014086+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:842:27)
2020-06-30T17:33:03.014086+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1026:19)
2020-06-30T17:33:03.014087+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-06-30T17:33:03.014087+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:3:12)
2020-06-30T17:33:03.014088+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1138:30)
2020-06-30T17:33:03.014088+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2020-06-30T17:33:03.014088+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:986:32)
2020-06-30T17:33:03.014089+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2020-06-30T17:33:03.014089+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
2020-06-30T17:33:03.014090+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',

目录:

enter image description here

在index.js中:

var app  = require('./src/app.js'); //  Note: I've tried require('src/app.js')

在Procfile中:

web: node index.js

我该如何解决?

0 个答案:

没有答案