我在Laravel的composer.json文件中收到以下错误...
错误:第10行的解析错误: ... l":" ~2016.04",}," require-dev"
---------------------- ^
期待' STRING'
composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"aimeos/aimeos-laravel": "~2016.04",
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*",
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan vendor:publish --tag=public --force",
"php artisan vendor:publish",
"php artisan migrate",
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
答案 0 :(得分:2)
请不要在最后一个对象的末尾使用“,”它告诉作曲家在此之后还有另一个字符串,并且作曲家没有找到任何其他字符串。所以你将面临这种错误......
删除逗号和快乐编码..
答案 1 :(得分:1)
您应该删除每个数组末尾的最后一个逗号。
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"aimeos/aimeos-laravel": "~2016.04"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan vendor:publish --tag=public --force",
"php artisan vendor:publish",
"php artisan migrate",
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
答案 2 :(得分:1)
您不能在JSON对象或数组中使用尾随逗号,您需要从以下行中删除它们
"aimeos/aimeos-laravel": "~2016.04",
"symfony/dom-crawler": "2.8.*|3.0.*",
答案 3 :(得分:0)
您应该在最后一行删除,,并且更好地练习使用 CMD命令。当你使用cmd时,它总是下载最新版本而且没有错误 composer.json
composer require aimeos/aimeos-laravel