【问题标题】:Heroku deployment postbuild for project structure项目结构的 Heroku 部署 postbuild
【发布时间】:2021-09-10 00:08:44
【问题描述】:
我的 MERN 项目结构是:
MyProject:
-server.js
-client
--index.js
postbuild 脚本包括 "heroku-postbuild":"NPM_CONFIG_PRODUCTION=false npm install cd client && npm run build cd client"
但我收到错误消息
【问题讨论】:
标签:
node.js
reactjs
mongodb
express
heroku
【解决方案1】:
当你跑步时
heroku logs --tail
您很可能会看到以下错误
Error: The `uri` parameter to `openUri()`
must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
这个问题之前问过here。
问题可能出在您的 env 文件位置或您的 env 文件中给出的 MONGO_URI 中。
或者您可以在那里查看更多解决方案。