heroku部署在生成后脚本MERN失败

时间:2020-09-10 17:31:00

标签: node.js reactjs heroku mern heroku-cli

努力将MERN应用程序部署到Heroku,

当使用postbuild脚本作为React Client时,问题通常围绕获取错误而发生。

我不知道如何解决以下问题。

这里是您希望完整查看代码的github存储库 https://github.com/4cody/taskAid

这是运行'git push heroku master'时来自终端的错误日志:

remote: -----> Build
remote:        Running heroku-postbuild
remote:        
remote:        > task-manager@1.0.0 heroku-postbuild /tmp/build_7c1b7cb2
remote:        > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote:        up to date in 0.261s
remote:        found 0 vulnerabilities
remote:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_7c1b7cb2/client/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_7c1b7cb2/client/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.DMldH/_logs/2020-09-10T17_22_33_338Z-debug.log      
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 254
remote: npm ERR! task-manager@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm 
install --prefix client && npm run build --prefix client`
remote: npm ERR! Exit status 254
remote: npm ERR!
remote: npm ERR! Failed at the task-manager@1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.DMldH/_logs/2020-09-10T17_22_33_369Z-debug.log      
remote: 
remote: -----> Build failed

这是项目Root中的package.json

    {
  "name": "task-manager",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "engines": {
    "node": "14.x"
  },
  "scripts": {
    "start": "node src/index.js",
    "dev": "env-cmd ./config/dev.env nodemon src/index.js",
    "test": "env-cmd ./config/test.env jest --watch --runInBand",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
  },
  "jest": {
    "testEnvironment": "node"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@sendgrid/mail": "^7.2.2",
    "bcryptjs": "^2.4.3",
    "express": "^4.17.1",
    "jsonwebtoken": "^8.5.1",
    "mongodb": "^3.5.9",
    "mongoose": "^5.9.25",
    "multer": "^1.4.2",
    "sharp": "^0.25.4",
    "validator": "^13.1.1"
  },
  "devDependencies": {
    "env-cmd": "^8.0.2",
    "jest": "^26.1.0",
    "nodemon": "^1.18.9",
    "supertest": "^4.0.2"
  }
}

我尝试过的事情:

  • 从可能已经存在的客户端中删除.git文件夹(我没有先检查)

  • 将节点版本添加到package.json

“引擎”:{ “ node”:“ 14.x” }

0 个答案:

没有答案