为什么我的Mern应用无法部署到Heroku?

时间:2020-10-05 13:16:49

标签: node.js heroku mern heroku-cli

我正在尝试将MERN堆栈应用程序部署到Heroku,我已经在package.json文件上进行了必要的配置,我已经在仪表板Heroku上尝试了Heroku CLI和Github Deploy,但是由于某种原因它没有部署...我有heroku postbuild脚本,我检查了多个站点并确认了
这是我的package.json;

{
  "name": "devconnector",
  "version": "1.0.0",
  "description": "Social Network for Developers",
  "main": "server.js",
  "scripts": {
    "start": "node server",
    "server": "nodemon server",
    "client": "npm start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\"",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
  },
  "engines": {
    "node": "14.11.0"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "config": "^3.3.2",
    "express": "^4.17.1",
    "express-validator": "^6.6.1",
    "gravatar": "^1.8.1",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.10.7",
    "request": "^2.88.2"
  },
  "devDependencies": {
    "concurrently": "^5.3.0",
    "nodemon": "^2.0.4"
  }
    }

这是错误日志;

-----> Node.js app detected
   
-----> Creating runtime environment
   
   NPM_CONFIG_LOGLEVEL=error
   NODE_ENV=production
   NODE_MODULES_CACHE=true
   NODE_VERBOSE=false
   
-----> Installing binaries
   engines.node (package.json):  14.11.0
   engines.npm (package.json):   unspecified (use default)
   
   Resolving node version 14.11.0...
   Downloading and installing node 14.11.0...
   Using default npm version: 6.14.8
   
-----> Installing dependencies
   Installing node modules
   
   > nodemon@2.0.4 postinstall /tmp/build_704248b1_/node_modules/nodemon
   > node bin/postinstall || exit 0
   
   Love nodemon? You can now support the project via the open collective:
    > https://opencollective.com/nodemon/donate
   
   added 324 packages in 7.74s
   
-----> Build
   Running heroku-postbuild
   
   > devconnector@1.0.0 heroku-postbuild /tmp/build_704248b1_
   > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
   
   up to date in 0.245s
   found 0 vulnerabilities
   
 npm ERR! code ENOENT
 npm ERR! syscall open
 npm ERR! path /tmp/build_704248b1_/client/package.json
 npm ERR! errno -2
 npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_704248b1_/client/package.json'
 npm ERR! enoent This is related to npm not being able to find a file.
 npm ERR! enoent 
 npm ERR! A complete log of this run can be found in:
 npm ERR!     /tmp/npmcache.TlmrF/_logs/2020-10-05T13_06_26_346Z-debug.log
 npm ERR! code ELIFECYCLE
 npm ERR! errno 254
 npm ERR! devconnector@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix                
 client && npm run build --prefix client`
 npm ERR! Exit status 254
 npm ERR! 
 npm ERR! Failed at the devconnector@1.0.0 heroku-postbuild script.
 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 npm ERR! A complete log of this run can be found in:
 npm ERR!     /tmp/npmcache.TlmrF/_logs/2020-10-05T13_06_26_372Z-debug.log
 -----> Build failed
   
   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys
   
   If you're stuck, please submit a ticket so we can help:
   https://help.heroku.com/
   
   Love,
   Heroku
   
     !     Push rejected, failed to compile Node.js app.
  !     Push failed

0 个答案:

没有答案