错误:找不到模块“ body-Parser”部署HEROKU

时间:2018-09-17 21:49:18

标签: node.js api heroku

我到处搜索,找不到解决方法

出现的错误 enter image description here

package.json

 {
  "name": "apirest",
  "version": "1.0.0",
  "description": "API para consultar rucs de Paraguay por numero o nommbre",
  "main":"index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "author": "Daniel Resoalbe resoalbe@gmail.com",
  "license": "ISC",
  "dependencies": {
    "bcrypt-nodejs": "0.0.3",
    "body-parser": "^1.18.3",
    "crypto": "^1.0.1",
    "express": "^4.16.3",
    "express-handlebars": "^3.0.0",
    "jwt-simple": "^0.5.1",
    "moment": "^2.22.2",
    "mongoose": "^5.2.15"
  },
  "devDependencies": {
    "nodemon": "^1.18.4"
  }
}

我在Heroku中寻找解决方案,但没有找到

1 个答案:

答案 0 :(得分:0)

这很可能是打错了,就像hardalgangurde所说的,顺便说一句,您甚至不需要安装正文解析器,它默认包含在express中。 您可以使用以下内置的中间件功能:

app.use(express.json());
app.use(express.urlencoded({ extended: false }));