首页 > 解决方案 > 运行部署到heroku的应用程序时出现内部服务器错误

问题描述

嘿伙计们,这是我第一次尝试将我的应用程序部署到 Heroku,但是一旦我运行命令,heroku open我就会发现错误

   Internal Server Error

运行后heroku logs它说

2019-09-04T20:33:45.744172+00:00 heroku[router]: at=info method=GET path="/" host=afternoon-peak-44025.herokuapp.com request_id=584c4aee-82d8-419d-8c5d-02cad873deba fwd="136.233.20.195" dyno=web.1 connect=1ms service=2ms status=500 bytes=404 protocol=https
2019-09-04T20:33:45.744392+00:00 app[web.1]: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object

谁能解释一下这是什么错误,我的 package.json 文件看起来像这样

{
  "name": "node",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "engines": { 
    "node":"12.9.1", 
    "npm":"6.10.2" 
    }, 
    "scripts": { 
    "start":"node index.js" 
    }, 
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  }
}

index.js 文件是

const express=require('express')
const app=express()
app.get('/',(req,res,next)=>{
    res.send({hi:'there'})
})
const PORT=process.env.PORT ||5000
app.listen(PORT)

标签: node.jsheroku

解决方案


推荐阅读