运行部署到heroku的应用程序时出现内部服务器错误

时间:2019-09-04 20:38:40

标签: node.js 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)

0 个答案:

没有答案