[英]Heroku : Cannot find module 'pg'?
2021-03-19T16:05:15.937220+00:00 app[web.1]:错误:找不到模块“pg”
2021-03-19T16:05:15.937220+00:00 应用程序 [web.1]:需要堆栈:
2021-03-19T16:05:15.937220+00:00 应用程序 [web.1]:-/app/models/db_schema.js
2021-03-19T16:05:15.937221+00:00 应用程序 [web.1]: - /app/controllers/event_controller.js
2021-03-19T16:05:15.937221+00:00 应用 [web.1]: - /app/router/event_routes.js
2021-03-19T16:05:15.937221+00:00 应用 [web.1]: - /app/app.js
这是我的 package.json
{
“名称”:“后端”,
“版本”:“1.0.0”,
“描述”: ””,
“主”:“app.js”,
“引擎”: {
"node": "v14.12.0",
"npm": "6.14.8"
},
“脚本”:{
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js",
"start:dev": "nodemon app.js",
"heroku-postbuild": "cd frontend && npm install && npm run build"
},
“存储库”:{
"type": "git",
"url": "git+https://github.com/shivamsouravjha/shawn-the-sheep.git"
},
“作者”:“shivam”,
“许可证”:“ISC”,
“错误”:{
"url": "https://github.com/shivamsouravjha/shawn-the-sheep/issues"
},
“主页”:“https://github.com/shivamsouravjha/shawn-the-sheep#readme”,
“开发依赖”:{
"nodemon": "^2.0.7",
"pg": "^8.5.1",
"router": "^1.3.5"
},
“依赖”:{
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-validator": "^6.10.0"
}
}
所以文件结构是:
/应用程序
----app.js
----node_modules/
还需要将 pg 从 devDependencies 移动到 Dependencies 并运行 npm run build。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.