解析错误:预期另一个键值对
Posted
技术标签:
【中文标题】解析错误:预期另一个键值对【英文标题】:Parse error: Expected another key-value pair 【发布时间】:2019-03-26 12:34:14 【问题描述】:我正在尝试在 Heroku 中为 Discord 托管一个机器人,但是在执行 git push heroku master
时它给了我这个错误:
Node.js app detected
remote: parse error: Expected another key-value pair at line 41, column 1
remote: ! Unable to parse package.json
remote:
remote:
remote: -----> Build failed
remote: parse error: Expected another key-value pair at line 41, column 1
remote: parse error: Expected another key-value pair at line 41, column 1
remote: parse error: Expected another key-value pair at line 41, column 1
这是package.json
文件的内容
"name": "sebas",
"version": "0.0.5",
"description": "un bot cualquiera",
"main": "index.js",
"engines":
"node": "8.x",
"npm": "*"
,
"scripts":
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
,
"repository":
"type": "git",
"url": "git+https://github.com/synicalsyntax/discord.js-heroku.git"
,
"keywords": [
"heroku",
"discord.js"
],
"author": "miguerubsk",
"license": "ISC",
"homepage": "https://github.com/synicalsyntax/discord.js-heroku#readme",
"dependencies":
"bufferutil": "^3.0.3",
"discord.io": "^2.5.3",
"discord.js": "^11.3.2",
"ffmpeg": "0.0.4",
"ffmpeg-binaries": "^3.2.2",
"node-gyp": "^3.6.2",
"opusscript": "0.0.6",
"uws": "^9.14.0",
"winser": "^1.0.3",
"ytdl-core": "^0.20.2"
,
"devDependencies": ,
"bugs":
"url": "https://github.com/synicalsyntax/discord.js-heroku/issues"
,
【问题讨论】:
(话虽如此,看起来您的 JSON 格式不正确:删除您的,
对象后的 ,
。)
我试过了还是不行
“还是不行”是什么意思?您收到相同的错误消息还是不同的错误消息?它是否引用相同的行和列?
我得到同样的错误
您肯定删除了最后一个逗号?你的新文件is valid?您是否已提交更改并重新部署到 Heroku?
【参考方案1】:
正如克里斯所说,您只需删除末尾的逗号即可。这应该是代码:
"name": "sebas",
"version": "0.0.5",
"description": "un bot cualquiera",
"main": "index.js",
"engines":
"node": "8.x",
"npm": "*"
,
"scripts":
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
,
"repository":
"type": "git",
"url": "git+https://github.com/synicalsyntax/discord.js-heroku.git"
,
"keywords": [
"heroku",
"discord.js"
],
"author": "miguerubsk",
"license": "ISC",
"homepage": "https://github.com/synicalsyntax/discord.js-heroku#readme",
"dependencies":
"bufferutil": "^3.0.3",
"discord.io": "^2.5.3",
"discord.js": "^11.3.2",
"ffmpeg": "0.0.4",
"ffmpeg-binaries": "^3.2.2",
"node-gyp": "^3.6.2",
"opusscript": "0.0.6",
"uws": "^9.14.0",
"winser": "^1.0.3",
"ytdl-core": "^0.20.2"
,
"devDependencies": ,
"bugs":
"url": "https://github.com/synicalsyntax/discord.js-heroku/issues"
【讨论】:
以上是关于解析错误:预期另一个键值对的主要内容,如果未能解决你的问题,请参考以下文章