【问题标题】:Deploying Strapi.io to Heroku getting [ERR_INVALID_URL]将 Strapi.io 部署到 Heroku 得到 [ERR_INVALID_URL]
【发布时间】:2020-05-15 03:46:06
【问题描述】:

我正在将strapi部署到heroku,但即使我遵循strapi.io的文档,也会得到一个无效的网址

这是我的日志

2020-01-29T15:32:54.185547+00:00 heroku[web.1]: Starting process with command `npm start`
2020-01-29T15:32:56.661385+00:00 app[web.1]:
2020-01-29T15:32:56.661405+00:00 app[web.1]: > strapiproject@0.1.0 start /app
2020-01-29T15:32:56.661408+00:00 app[web.1]: > strapi start
2020-01-29T15:32:56.661410+00:00 app[web.1]:
2020-01-29T15:32:58.561874+00:00 app[web.1]: [2020-01-29T15:32:58.560Z] debug ⛔️ Server wasn't able to start properly.
2020-01-29T15:32:58.563363+00:00 app[web.1]: [2020-01-29T15:32:58.563Z] error TypeError [ERR_INVALID_URL]: Invalid URL: http://undefined:undefined
2020-01-29T15:32:58.563366+00:00 app[web.1]: at onParseError (internal/url.js:257:9)
2020-01-29T15:32:58.563368+00:00 app[web.1]: at new URL (internal/url.js:333:5)
2020-01-29T15:32:58.563370+00:00 app[web.1]: at new URL (internal/url.js:330:22)
2020-01-29T15:32:58.563372+00:00 app[web.1]: at module.exports (/app/node_modules/strapi/lib/core/bootstrap.js:375:29)
2020-01-29T15:32:58.563374+00:00 app[web.1]: at Strapi.load (/app/node_modules/strapi/lib/Strapi.js:381:11)
2020-01-29T15:32:58.563376+00:00 app[web.1]: at async Strapi.start (/app/node_modules/strapi/lib/Strapi.js:224:7)
2020-01-29T15:32:58.578108+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-01-29T15:32:58.578677+00:00 app[web.1]: npm ERR! errno 1
2020-01-29T15:32:58.580772+00:00 app[web.1]: npm ERR! strapiproject@0.1.0 start: `strapi start`
2020-01-29T15:32:58.581113+00:00 app[web.1]: npm ERR! Exit status 1
2020-01-29T15:32:58.581578+00:00 app[web.1]: npm ERR!
2020-01-29T15:32:58.581775+00:00 app[web.1]: npm ERR! Failed at the strapiproject@0.1.0 start script.
2020-01-29T15:32:58.581960+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-01-29T15:32:58.593798+00:00 app[web.1]:
2020-01-29T15:32:58.594034+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-01-29T15:32:58.594423+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-01-29T15_32_58_583Z-debug.log
2020-01-29T15:32:58.682466+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-29T15:32:58.662766+00:00 heroku[web.1]: Process exited with status 1
2020-01-29T15:33:00.541839+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=peaceful-peak-28060.herokuapp.com request_id=716a3aa3-ed3a-4429-880d-f04b4fb04b91 fwd="203.189.116.189" dyno= connect= service= status=503 bytes= protocol=https
2020-01-29T15:33:02.026655+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=peaceful-peak-28060.herokuapp.com request_id=459549bb-6f30-444a-9f19-e45549a5a655 fwd="203.189.116.189" dyno= connect= service= status=503 bytes= protocol=https

我在 mysql 数据库上安装了strapi,并使用JawsDB 部署它,并遵循它的文档。有谁知道是什么导致了这个问题?

【问题讨论】:

    标签: mysql node.js heroku npm strapi


    【解决方案1】:

    您的问题看起来来自https://github.com/strapi/strapi/blob/master/packages/strapi/lib/core/bootstrap.js#L375

    如果我检查代码,它是以下内容:

    const adminPath = _.get(
      strapi.config.currentEnvironment.server,
      'admin.path',
      'admin'
    );
    
    strapi.config.admin.url = new URL(adminPath, strapi.config.url).toString();
    

    您能否在./config/environments/production/server.json 中验证您的admin

    【讨论】:

      猜你喜欢
      • 2011-12-18
      • 2014-08-02
      • 2020-07-28
      • 2012-08-10
      • 2012-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多