Heroku 部署成功但显示应用程序错误

时间:2021-06-08 02:05:26

标签: node.js heroku

现在,我正在使用 Heroku 从 GitHub 部署我的应用程序。这是部署输出日志:

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  16.x
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 16.x...
       Downloading and installing node 16.3.0...
       Using default npm version: 7.15.1
       
-----> Installing dependencies
       Installing node modules (package.json)
       
       added 149 packages, and audited 150 packages in 9s
       
       10 packages are looking for funding
         run `npm fund` for details
       
       found 0 vulnerabilities
       
-----> Build
       
-----> Caching build
       - node_modules
       
-----> Pruning devDependencies
       
       up to date, audited 150 packages in 866ms
       
       10 packages are looking for funding
         run `npm fund` for details
       
       found 0 vulnerabilities
       
-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 48M
-----> Launching...
       Released v3
       https://dino-pack.herokuapp.com/ deployed to Heroku

但是,当我转到 dino-pack.herokuapp.com 时,它向我显示: enter image description here

有什么问题,我该如何解决?我已经尝试删除并重新制作应用程序,但它仍然显示这一点。

2 个答案:

答案 0 :(得分:0)

据我所知,从您的日志中可以看出,似乎存在路径解析问题。一些模块不能很好地处理相对路径。

如果您在某处有使用相对路径的导入,我会尝试将其更改为有效的相对格式,或者首先尝试使用绝对路径,然后查看日志中显示的内容。

这只是一个猜测,因为您不想共享您的代码。

答案 1 :(得分:0)

检查您的设置是否正确,Procfile 和 package.json。按照设置指南进行仔细检查。我确定这是一个愚蠢的错误,但我们需要更多信息来找出它是什么。