将 MERN 应用程序部署到 Heroku 时出现“run: not found”错误

时间:2021-02-20 09:04:09

标签: node.js reactjs express heroku mern

我正在尝试将我的 MERN Web 应用程序部署到 Heroku,但出现此错误:

remote: sh: 1: run: not found
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! syscall spawn
remote: npm ERR! file sh
remote: npm ERR! errno ENOENT
remote: npm ERR! reach-app@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install npm && run build`
remote: npm ERR! spawn ENOENT
remote: npm ERR! 
remote: npm ERR! Failed at the reach-app@1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

就我的结构而言,我的根目录中有两个目录,分别称为clientbackend。这两个目录都有自己的 package.json。我还在根目录中初始化了 git 和另一个 npm。那么,这可能是我的文件结构有问题吗?

似乎没有其他类似的问题,因此我们将不胜感激。谢谢

编辑: 这是我的根目录中的 package.json:

{
  "name": "reach-app",
  "version": "1.0.0",
  "description": "Initialised npm for the root directory.",
  "main": "index.js",
  "scripts": {
    "start": "node backend/server/index.js",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install && npm run build",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "example",
    "heroku"
  ],
  "author": "Phillip La",
  "license": "ISC",
  "engines": {
    "node": "12.16.2"
  }
}

0 个答案:

没有答案