Node.js MERN应用程序存储到Heroku-未找到package.json

Node.js MERN应用程序存储到Heroku-未找到package.json,node.js,reactjs,git,heroku,npm,Node.js,Reactjs,Git,Heroku,Npm,我正在尝试使用Heroku CLI在线获取MERN应用程序。该应用程序在本地运行良好,但当我尝试使用git将该应用程序推送到Heroku上时,会收到以下错误消息: remote: Running heroku-postbuild remote: remote: > exercise-logger@1.0.0 heroku-postbuild /tmp/build_431a136c remote: > NPM_CONFIG_PR

我正在尝试使用Heroku CLI在线获取MERN应用程序。该应用程序在本地运行良好,但当我尝试使用git将该应用程序推送到Heroku上时,会收到以下错误消息:

remote:        Running heroku-postbuild
remote:        
remote:        > exercise-logger@1.0.0 heroku-postbuild /tmp/build_431a136c
remote:        > NPM_CONFIG_PRODUCTION=false npm install --prefix exercise-logger && npm run build --prefix exercise-logger
remote:        
remote:        up to date in 0.22s
remote:        found 0 vulnerabilities
remote:        
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_431a136c/exercise-logger/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_431a136c/exercise-logger/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.yesMz/_logs/2021-05-30T17_32_30_947Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 254
remote: npm ERR! exercise-logger@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix exercise-logger && npm run build --prefix exercise-logger`
remote: npm ERR! Exit status 254
remote: npm ERR! 
remote: npm ERR! Failed at the exercise-logger@1.0.0 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.yesMz/_logs/2021-05-30T17_32_30_973Z-debug.log
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        Some possible problems:
remote:        
remote:        - node_modules checked into source control
remote:          https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote:  !
它的主旨似乎是找不到root package.json文件,尽管它肯定在那里。事实上,这是:

"name": "exercise-logger",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "dependencies": {
    "axios": "^0.21.1",
    "bcrypt": "^5.0.1",
    "concurrently": "^6.0.2",
    "config": "^3.3.6",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "express-validator": "^6.10.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.12.3"
  },
  "devDependencies": {},
  "scripts": {
    "start": "node server.js",
    "build": "cd client && npm run build",
    "server": "nodemon server.js",
    "client": "npm start --prefix client",
    "clientinstall": "npm install --prefix client",
    "dev": "concurrently \"npm run start\" \"npm run client\"",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
  },
  "engines": {
    "node": "14.x",
    "npm": "6.x"
  },
  "author": "",
  "license": "ISC"
}

我尝试了一个常见的修复方法,手动删除React应用程序目录中的.git文件夹,但似乎没有修复它

整个代码都在Github上

有人能帮忙吗?我已经在这个项目上工作了很长一段时间了,所以在最后关头摔倒真的很令人沮丧。我以前没有做过类似的事情,所以不确定从哪里开始故障排除


谢谢

这可能是问题的根源,也可能不是问题的根源,但您的github回购协议似乎显示git跟踪无效。例如,您的回购缺少整个
客户端
源和
节点_模块
不应被跟踪(
.gitignore
应忽略)。谢谢,这听起来很有希望。。。我做了一个git add--all,它将客户机源中的所有内容添加到下一次提交中,但仍然收到与Heroku相同的错误消息,并推送到Github,但它仍然显示缺少的客户机源,而不是更新的客户机源?很抱歉听起来像个十足的白痴,我也没怎么用git。我还需要根目录中的.gitignore文件吗?(客户端文件夹中有一个,其中有节点_模块……)应该有根
gitignore
。看见有关详细信息,请参见自述。