heroku构建错误“在client@0.1.0构建脚本处失败”

时间:2018-10-17 21:57:56

标签: reactjs heroku npm deployment build

我正在尝试将带有服务器的react应用程序部署到heroku。一切都可以在localhost上运行,但是当我将应用程序部署到heroku时,会收到此错误消息。

   > Refutation-bot@1.0.0 heroku-postbuild /tmp/build_df21544697561909eb51d857026aae6e
   > cd client && npm install --only=dev && npm install && npm run build

   up to date in 7.168s
   added 1181 packages in 29.535s

   > client@0.1.0 build /tmp/build_df21544697561909eb51d857026aae6e/client
   > react-scripts build

sh: 1: react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! client@0.1.0 build: `react-scripts build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the client@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.on043/_logs/2018-10-17T21_17_17_261Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Refutation-bot@1.0.0 heroku-postbuild: `cd client && npm install --only=dev && npm install && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the Refutation-bot@1.0.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.on043/_logs/2018-10-17T21_17_17_277Z-debug.log
-----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys

   Some possible problems:

   - node_modules checked into source control
     https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits

   Love,
   Heroku

 !     Push rejected, failed to compile Node.js app.
 !     Push failed

我认为该错误与构建脚本有关。这是我的package.json在根文件夹中:

{
  "name": "Refutation-bot",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node server.js",
    "test": "echo \"Error: no test specified\" && exit 1",
    "heroku-postbuild": "cd client && npm install --only=dev && npm install && npm run build"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.18.0",
    "dotenv": "^6.0.0",
    "express": "^4.16.4",
    "express-jwt": "^5.3.1",
    "jsonwebtoken": "^8.3.0",
    "mongoose": "^5.2.8",
    "morgan": "^1.9.1",
    "nodemon": "^1.18.4",
    "react-s-alert": "^1.4.1",
    "sh": "0.0.3",
    "sweetalert": "^2.1.0",
    "uuid": "^3.3.2"
  },
  "engines": {
    "node": "8.12.0"
  }
}

我的react应用程序位于我的根文件夹中的一个名为client的文件夹中,这是推送到heroku的标准,所以我认为应该没有任何问题。除此之外,我无话可说。

0 个答案:

没有答案