如何解决将 MERN 应用程序部署到 Heroku 时出现“run: not found”错误
我正在尝试将我的 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.
就我的结构而言,我的根目录中有两个目录,分别称为client 和backend。这两个目录都有自己的 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"
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。