在bash终端中键入“ npm start”时出现多个错误

时间:2019-11-15 17:19:33

标签: json npm

这些是我在bash终端中输入“ npm start”时收到的错误:

npm ERR! code EJSONPARSE

npm ERR! file /Users/nickperry/Desktop/NucampFolder/git-test/package.json

npm ERR! JSON.parse Failed to parse json

npm ERR! JSON.parse Unexpected token } in JSON at position 234 while parsing near '...": "lite-server",

npm ERR! JSON.parse   },

npm ERR! JSON.parse   "repository": {...'

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!     /Users/nickperry/.npm/_logs/2019-11-15T17_16_58_597Z-debug.log

以下是我的package.json文件夹的内容:

    {
  "name": "git-test",
  "version": "1.0.0",
  "description": "Git and NPM",
  "main": "index.html",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npm run lite",
    "lite": "lite-server",
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/NickPurry/git-test.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/NickPurry/git-test/issues"
  },
  "homepage": "https://github.com/NickPurry/git-test#readme",
  "devDependencies": {
    "lite-server": "^2.3.0"
  }
}

这里的任何帮助将不胜感激。谢谢。

2 个答案:

答案 0 :(得分:1)

第234行还有一个逗号。数组中最后一个元素的末尾不能有逗号。

答案 1 :(得分:0)

与JavaScript Object Literal不同,JSON不需要在对象的最后一个名称/值之间添加逗号。因此,您需要删除名称值par "lite": "lite-server"

之后的逗号

使用此:

    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "start": "npm run lite",
        "lite": "lite-server"
    }