npm ERR! code EJSONPARSE

npm ERR! code EJSONPARSE

npm ERR! JSON.parse Failed to parse json
问题出现形式如下:

npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 513 while parsing '{
npm ERR! JSON.parse   "name": "sell",
npm ERR! JSON.parse   "version": "1.0.0"'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\57401\AppData\Roaming\npm-cache\_logs\2018-07-12T13_13_45_                                        726Z-debug.log

错误原因是:package.json文件的格式问题。检查属性名称喝属性值是否都用 “”
括起来;还有最后一个依赖的末尾不需要加 “,”;以及冒号问题。

正确的格式如下:

  "dependencies": {
    "babel-runtime": "^6.26.0",
    "vue": "^2.5.2",
    "vue-resource": "^1.5.1",
    "vue-router": "^3.0.1"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.22.1",
    "babel-eslint": "^8.2.1",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^7.1.1",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.26.0",
    "chalk": "^2.0.1",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.28.0"
    }

猜你喜欢

转载自blog.csdn.net/leng_nuan/article/details/81030393