简体   繁体   中英

Heroku deployment: JSON parse error in package.json despite being valid

I am trying to deploy a mern app, but I get the following error, despite checking my package.json file myself and in multiple websites, what could be the issue here please?


> Compressing source files... done.
Building source:

-----> Node.js app detected
parse error: Expected another key-value pair at line 12, column 3
 !     Unable to parse package.json


-----> 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

HERE IS MY PACKAGE.JSON FILE

{
  "name": "backend",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index",
    "dev": "nodemon index",
    "build": "cd client && npm run build",
    "install-client": "cd client && npm install",
    "heroku-postbuild": "npm run install-client && npm run build"
  },
  "keywords": ["books"],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@hapi/joi": "^17.1.1",
    "bcrypt": "^5.0.0",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.9.18"
  },
  "devDependencies": {
    "nodemon": "^2.0.4"
  }
}

try this

{
    "name": "backend",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "start": "node index",
      "build": "cd client && npm run build",
      "install-client": "cd client && npm install",
      "heroku-postbuild": "npm run install-client && npm run build"
    },
    "keywords": ["books"],
    "author": "",
    "license": "ISC",
    "dependencies": {
      "@hapi/joi": "^17.1.1",
      "bcrypt": "^5.0.0",
      "cors": "^2.8.5",
      "express": "^4.17.1",
      "jsonwebtoken": "^8.5.1",
      "mongoose": "^5.9.18"
    }
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM