【发布时间】:2018-01-02 15:04:12
【问题描述】:
我是 JavaScript 和 JSON 的新手,我正在尝试上传我的 NPM 包。出于某种原因,当我尝试发布它时出现此错误:
Unexpected token } in JSON at position 351 while parsing near '..."license": "ISC",
},
"bugs": {
"e..."
这是我的 JSON 文件。
{
"name": "M-P-Formulas-JS",
"version": "1.0.0",
"description": "The M-P-Formulas package for JavaScript. This package allows the user to use math and physics formulas such as the Pythagorean Theorem.",
"main": "mpformulasJS.js",
"author": {
"email": "8b21espq@gmail.com",
"name": "Jeff Lockhart",
"url": "",
"license": "ISC",
},
"bugs": {
"email": "8b21espq@gmail.com",
},
"dependencies": {
"Math": "",
},
"keywords": [
"mpformulas",
"mpformulasjs",
"m-p-formulas-js",
"math",
"physics",
"formulas",
"module",
"package",
],
}
我什至跑了npm cache clean,但由于它不起作用,我可以保证我的代码是错误的。如果是这样,我该如何解决?
谢谢。
【问题讨论】:
-
去掉关键字数组后面的逗号。删除每个尾随逗号
-
什么代码错了?你的代码在哪里?
-
JSON 不允许在数组的最后一个元素之后使用逗号。
-
实际上,删除每个对象或数组的最后一行后的尾随逗号。我至少可以看到 5 个。
-
所有尾随逗号是 JSON 中的语法错误。
标签: javascript json node.js npm