我制作了一个composer.json脚本。
当我运行sudo composer install
时,我收到此错误:
[Seld\JsonLint\ParsingException]
"./composer.json" does not contain valid JSON
Parse error on line 1:
"repositories": [ { "t
--------------^
Expected one of: 'EOF', '}', ',', ']'
这是JSON:
"repositories": [
{
"type":"package",
"package": {
"name": "AdamKyle/Aisis-Core",
"version":"development",
"source": {
"url": "https://github.com/AdamKyle/Aisis-Core.git",
"type": "git",
"reference":"development"
}
}
}
],
"require": {
"AdamKyle/Aisis-Core": "development"
}
如何更好地描述此JSON的错误?
答案 0 :(得分:11)
您的JSON不好,请将您的JSON粘贴到此网站:http://jsonlint.com/
它返回错误:
Parse error on line 1:
"repositories": [
^
Expecting '{', '['
如果您在开始时使用{
并在最后使用}
包围整个JSON,则无效的JSON将变为有效。
答案 1 :(得分:0)
您应该在文件的开头和结尾添加"["
和"]"
。
答案 2 :(得分:0)
在这里你可以像这样使用它。
尝试使用它可以帮助您恢复错误。
{
"repositories": [{
"type": "package",
"package": {
"name": "AdamKyle/Aisis-Core",
"version": "development",
"source": {
"url": "https://github.com/AdamKyle/Aisis-Core.git",
"type": "git",
"reference": "development"
}
}
}],
"require": {
"AdamKyle/Aisis-Core": "development"
}
}
答案 3 :(得分:0)
我将分享我的$ 0.02。由于GIT冲突,我不止一次面对这个问题。因此,有时您的composer.lock
会有以下冲突指示:
<<<<<<< HEAD
"funding": [
{
"url": "https://github.com/jenssegers",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/jenssegers/agent",
"type": "tidelift"
}
],
=======
>>>>>>> a19a747062fe0ace379f410ad94e27463eee436c
当无法正确解决git冲突时,将注入这些东西,从而使锁定文件无效。要解决此问题,只需将锁定文件与文件历史记录进行比较即可删除其冲突部分。
答案 4 :(得分:-1)
我的文本编辑器的引号无效,请尝试将此文件复制并粘贴到文本文件中:“