问题描述
努力将MERN应用程序部署到Heroku,
当使用postbuild脚本作为React Client时,问题通常围绕获取错误而发生。
我不知道如何解决以下问题。
这里是您希望完整查看代码的github存储库 https://github.com/4cody/taskAid
这是运行'git push heroku master'时来自终端的错误日志:
remote: -----> Build
remote: Running heroku-postbuild
remote:
remote: > [email protected] 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! [email protected] 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 [email protected] 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” }
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)