首页 > 解决方案 > 预计第 32 行第 1 列远程的另一个键值对:!无法解析 package.json

问题描述

我试图将 MERN 堆栈应用程序部署到 heroku,但这样做时遇到了一些问题。当我尝试部署它时,它会给我这个错误,说Expected another key value pair at line 32 column 1有人可以解释这意味着什么以及我该如何解决它?谢谢 !!

{
  "name": "axios-react",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.18.0",
    "cors": "^2.8.4",
    "google-map-react": "^1.0.4",
    "google-maps-react": "^2.0.2",
    "node": "^10.12.0",
    "react": "^16.3.2",
    "react-dom": "^16.3.2",
    "react-geolocated": "^2.4.0",
    "react-geolocation": "^1.0.3",
    "react-google-maps": "^9.4.5",
    "react-places-autocomplete": "^7.1.2",
    "react-router": "^4.3.1",
    "react-router-dom": "^4.3.1",
    "react-scripts": "^1.1.4",
    "react-star-rating": "^1.4.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "start-js": "react-scripts",
    "build": "react-scripts build",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "proxy": "http://localhost:5000/",
}

标签: node.js

解决方案


删除“代理”行末尾的最后一个逗号。像这样:

{
  "name": "axios-react",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.18.0",
    "cors": "^2.8.4",
    "google-map-react": "^1.0.4",
    "google-maps-react": "^2.0.2",
    "node": "^10.12.0",
    "react": "^16.3.2",
    "react-dom": "^16.3.2",
    "react-geolocated": "^2.4.0",
    "react-geolocation": "^1.0.3",
    "react-google-maps": "^9.4.5",
    "react-places-autocomplete": "^7.1.2",
    "react-router": "^4.3.1",
    "react-router-dom": "^4.3.1",
    "react-scripts": "^1.1.4",
    "react-star-rating": "^1.4.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "start-js": "react-scripts",
    "build": "react-scripts build",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "proxy": "http://localhost:5000/"
}

每当您在 json 中指定逗号时,它都需要一个键值对,这解释了错误


推荐阅读