Node.js 如何修复NPM EJSONParse?

Node.js 如何修复NPM EJSONParse?,node.js,json,npm,npm-scripts,Node.js,Json,Npm,Npm Scripts,您好在我准备了自动脚本并安装了几个软件包来自动化我的任务后,我遇到了以下错误: npm ERR! file C:\Users\windw\Desktop\bootstrap4\package.json npm ERR! code EJSONPARSE npm ERR! JSON.parse Failed to parse json npm ERR! JSON.parse Unexpected string in JSON at position 455 while parsing '{ npm

您好在我准备了自动脚本并安装了几个软件包来自动化我的任务后,我遇到了以下错误:

npm ERR! file C:\Users\windw\Desktop\bootstrap4\package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 455 while parsing '{
npm ERR! JSON.parse   "name": "confusion",
npm ERR! JSON.parse   "version": '
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
下面是我的
package.json
文件

{
  "name": "confusion",
  "version": "1.0.0",
  "description": "This is a website for Ristorante Con Fusion",
  "main": "index.html",
  "scripts": {
    "start": "npm run watch:all",
    "test": "echo \"Error: no test specified\" && exit 1",
    "lite": "lite-server",
    "scss": "node-sass -o css/ css/",
    "watch:scss": "onchange \"css/*.scss\" -- npm run scss",
    "watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\""
    "clean": "rimraf dist",
    "copyfonts": "copyfiles -f node_modules/font-awesome/fonts/* dist/fonts",
    "imagemin": "imagemin img/* --out-dir='dist/img'",
    "usemin": "usemin contactus.html -d dist --htmlmin -o dist/contactus.html && usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html && usemin index.html -d dist --htmlmin -o dist/index.html",
    "build": "npm run clean && npm run imagemin && npm run copyfonts && npm run usemin"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "cssmin": "^0.4.3",
    "htmlmin": "0.0.7",
    "lite-server": "^2.3.0",
    "node-sass": "^4.7.2",
    "onchange": "^6.1.0",
    "parallelshell": "^3.0.2",
    "rimraf": "^2.6.2",
    "uglifyjs": "^2.4.11",
    "usemin-cli": "^0.5.1"
  },
  "dependencies": {
    "bootstrap": "^4.3.1",
    "bootstrap-social": "5.1.1",
    "font-awesome": "4.7.0",
    "jquery": "^3.4.1",
    "popper.js": "1.12.9"
  }
}

package.json
文件的第12行末尾缺少一个逗号

现在看起来是这样的:

"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\""
"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\"",
应该是这样的:

"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\""
"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\"",

请注意行末尾的逗号。

您是否尝试过使用语法突出显示的编辑器?您将立即看到JSON中的问题在哪里。或者,验证JSON,感谢您在语法上修复了该问题