[英]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.