我是symfony的新手,我有以下问题。 运行composer install命令时, Class'JMS \ SerializerBundle \ JMSSerializerBundle'找不到AppKernel 。
这是我的AppKernel文件:
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new FOS\UserBundle\FOSUserBundle(),
new FOS\RestBundle\FOSRestBundle(),
new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
);
这是我的composer.json文件。
{
"name": "gigi/api",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/"
}
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"jms/metadata": ">=1.1.0,<1.3-dev",
"jms/serializer": "dev-master",
"jms/serializer-bundle": "dev-master",
"friendsofsymfony/user-bundle": "2.0.*@dev",
"friendsofsymfony/rest-bundle": "1.4.*@dev",
"friendsofsymfony/oauth-server-bundle": "1.4.*@dev",
"nelmio/api-doc-bundle": "2.5.*@dev"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "5.3.9"
}
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
}
}
}
我做错了什么?
谢谢
答案 0 :(得分:0)
看起来这个库不可用,所以你有两个选择:
您可以从composer.json中删除jmsserializer并将其用作:
composer需要jms / serializer-bundle
我想保留composer.json,因为它可以运行:
composer update jms / serializer-bundle
编辑1:为什么会这样?
当您运行composer install
时,它将获取您的composer.lock文件,然后安装依赖项,正如您所看到的,symfony有一些依赖于symfony安装的安装后/更新脚本,这需要JMS序列化程序。引导。
在这种情况下,您的composer.lock已过时,因此您需要要求或更新缺少的包。
我希望这可以帮到你!