将 nodejs 应用程序部署到 heroku 时遇到问题

Loa*_*low 5 heroku node.js express reactjs

我正在尝试将 nodejs 应用程序部署到 heroku,但在检查时出现以下错误heroku logs

sh:1: npm-run-all : 未找到

我的package.json看起来像这样

 {


         "name": "web-training",
          "version": "1.0.0",
          "description": "web-training",
          "scripts": {
            "prestart": "babel-node tools/startMessage.js",
            "start": "npm-run-all --parallel open:src lint:watch test:watch",
            "open:src": "babel-node tools/srcServer.js",
            "lint": "node_modules/.bin/esw webpack.config.* src tools",
            "lint:watch": "npm run lint -- --watch",
            "test": "mocha --reporter spec tools/testSetup.js \"src/**/*.test.js\"",
            "test:watch": "npm run test -- --watch",
            "clean-dist": "npm run remove-dist && mkdirp dist-server/dist",
            "remove-dist": "node_modules/.bin/rimraf ./dist-server/dist",
            "build:html": "babel-node tools/buildHtml.js",
            "prebuild": "npm-run-all clean-dist test lint build:html",
            "build": "babel-node tools/build.js",
            "postbuild": "babel-node dist-server/server.js"
          },
          "author": "Cory House",
          "license": "MIT",
          "dependencies": {
            "babel-polyfill": "6.8.0",
            "bootstrap": "3.3.6",
            "compression": "^1.6.1",
            "express": "^4.13.4",
            "install": "^0.8.4",
            "jquery": "2.2.3",
            "material-ui": "^0.16.7",
            "npm": "^4.0.5",
            "open": "0.0.5",
            "rd-react-overlay": "^1.4.2",
            "react": "15.0.2",
            "react-dom": "15.0.2",
            "react-native-search-bar": "^2.16.0",
            "react-native-vector-icons": "^4.0.0",
            "react-redux": "4.4.5",
            "react-router": "2.4.0",
            "react-router-redux": "4.0.4",
            "react-skylight": "^0.4.1",
            "react-tap-event-plugin": "^2.0.1",
            "redux": "3.5.2",
            "redux-thunk": "2.0.1",
            "toastr": "2.1.2"
          },
          "devDependencies": {
            "axios-mock-adapter": "^1.7.1",
            "babel-cli": "6.8.0",
            "babel-core": "6.8.0",
            "babel-loader": "6.2.4",
            "babel-plugin-react-display-name": "2.0.0",
            "babel-preset-es2015": "6.6.0",
            "babel-preset-react": "6.5.0",
            "babel-preset-react-hmre": "1.1.1",
            "babel-register": "6.8.0",
            "colors": "1.1.2",
            "compression": "1.6.1",
            "cross-env": "1.0.7",
            "css-loader": "0.23.1",
            "enzyme": "2.2.0",
            "eslint": "2.9.0",
            "eslint-plugin-import": "1.6.1",
            "eslint-plugin-react": "5.0.1",
            "eslint-watch": "2.1.11",
            "eventsource-polyfill": "0.9.6",
            "expect": "1.19.0",
            "express": "4.13.4",
            "extract-text-webpack-plugin": "1.0.1",
            "file-loader": "0.8.5",
            "jsdom": "8.5.0",
            "mocha": "2.4.5",
            "nock": "8.0.0",
            "npm-run-all": "1.8.0",
            "open": "0.0.5",
            "react-addons-test-utils": "15.0.2",
            "react-search-component": "^1.1.2",
            "redux-immutable-state-invariant": "1.2.3",
            "redux-mock-store": "1.0.2",
            "rimraf": "2.5.2",
            "style-loader": "0.13.1",
            "url-loader": "0.5.7",
            "webpack": "1.13.0",
            "webpack-dev-middleware": "1.6.1",
            "webpack-hot-middleware": "2.10.0"
          },
          "repository": {
            "type": "git",
            "url": "https://github.com/XXX/YYY"
          }
}
Run Code Online (Sandbox Code Playgroud)

当我在本地运行我的应用程序时 npm run build在命令行中在,它运行良好。有什么建议?

我正在添加 Procfile 内容:

web:npm run build  
Run Code Online (Sandbox Code Playgroud)

我不确定这是否可以。

小智 -1

\xc2\xb7 首先在 git 和 heroku 中创建你的帐户

\n\n

\xc2\xb7 在你的系统上安装 git 和 heroku ..如果你使用 Windows 必须安装 git bash

\n\n

\xc2\xb7 在 git 中创建你的存储库

\n\n

\xc2\xb7 现在找出下面的命令

\n\n
  -git init\n\n  -git clone {git repository url}\n\n  -cd {repository folder name}\n
Run Code Online (Sandbox Code Playgroud)\n\n

\xc2\xb7 将代码复制到本地 git 存储库文件夹中

\n\n

\xc2\xb7 打开终端,转到您的存储库文件夹,然后应用以下命令

\n\n
  -git init\n\n  -git add *\n\n  -git commit -m "your comment"\n\n  -git status\n\n  -git push origin master\n
Run Code Online (Sandbox Code Playgroud)\n\n

\xc2\xb7 检查 git 云上的 git 存储库

\n\n

\xc2\xb7 打开新终端应用以下命令

\n\n
  -git clone {repository url}\n\n  -cd {repository url}\n\n  -heroku login\n\n  -heroku create {name of your application on heroku}\n\n  -git remote(to verify heroku)\n\n  -git push heroku master\n\n  -heroku open\n
Run Code Online (Sandbox Code Playgroud)\n\n

**请按照上述步骤在heroku中部署您的代码*

\n\n

您可以使用以下命令为heroku部署制作演示节点js项目

\n\n
    \n
  • 表达{项目名称}--ejs
  • \n
  • cd {项目名称}
  • \n
  • npm 安装
  • \n
  • npm 启动
  • \n
\n