【问题标题】:NodeJs Heroku Deployment Failing on BuildNodeJs Heroku 部署在构建时失败
【发布时间】:2019-03-05 17:43:16
【问题描述】:

我只是想将我的 Web 应用程序构建到 Heroku。我能够在本地“构建”我的客户端,但由于某种原因,当我 git push heroku master 时 Heroku 正在构建它时,构建失败了......

Module not found: Error: Can't resolve './components/Authentication/login' in '/tmp/build_9709419844244c794729ea02221256db/client/src'

当我运行 npm run build 时,此组件存在并且正在本地构建。我的服务器 package.json 如下:

{
"name": "server",
"version": "1.0.0",
"description": "This is the server",
"engines": {
"node": "9.8.x"
 },
"main": "index.js",
"scripts": {
"start": "node server",
"heroku-postbuild": "cd client/ && npm install && npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"cacheDirectories": [
"node_modules",
"client/node_modules"
],
"author": "Chris and Patrick",
  "license": "ISC",
  "dependencies": {
"axios": "^0.18.0",
"body-parser": "^1.18.3",
"dotenv": "^6.0.0",
"express": "^4.16.3",
"firebase": "^5.5.0",
"firebase-admin": "^6.0.0",
"jimp": "^0.5.3",
"mime-types": "^2.1.20",
"multer": "^1.4.0",
    "uuid-v4": "^0.1.0"
  }
}

上面是我的主要 package.json 文件。

我尝试清除构建缓存并再次运行生产构建,但收到以下错误:

Cannot run one-off process at this time. Please try again later.

【问题讨论】:

  • 本地安装但 rm node_modules 所以模拟完整安装。应该在本地重现相同的错误
  • 嘿罗伯特。我在客户端删除了 node_modules,在本地运行了安装 && 构建,它工作得非常好。 Heroku 构建仍然在完全相同的位置损坏。
  • heroku 运行 bash 以 shell 进入远程,以尝试了解为什么在 localhost 上正确构建的文件/包没有在远程到达那里\

标签: node.js heroku heroku-cli


【解决方案1】:

我能够解决问题。

问题是 github 无法识别文件夹名称大小写更改。我不得不重命名每个组件文件夹并重新推送给 heroku master。工作正常。

【讨论】:

    猜你喜欢
    • 2018-09-01
    • 2020-10-09
    • 1970-01-01
    • 2019-02-16
    • 2016-02-20
    • 2020-12-29
    • 2021-12-27
    • 2019-04-14
    • 2022-06-14
    相关资源
    最近更新 更多