symfony-cmf / standard-edition

The "Symfony CMF Standard Edition" distribution
cmf.symfony.com
MIT License
118 stars 48 forks source link

Standard installer: Fatal error Class JMSSerializerBundle #45

Closed alexseif closed 8 years ago

alexseif commented 8 years ago

I just ran composer create-project symfony-cmf/standard-edition cmf "~1.2" configured for mysql and got

PHP Fatal error:  Class 'JMS\SerializerBundle\JMSSerializerBundle' not found in /srv/www/cmf/app/AppKernel.php on line 38
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception

  [RuntimeException]                                                                                                        
  An error occurred when executing the "'cache:clear --no-warmup'" command:                                                  
  PHP Fatal error:  Class 'JMS\SerializerBundle\JMSSerializerBundle' not found in /srv/www/cmf/app/AppKernel.php on line 38  

Here's what happened http://pastebin.com/EPJUFisk

dbu commented 8 years ago

i think the reason is that the hard dependency on jms serializer was dropped in createbundle, and it thus is no longer installed. can you remove that in AppKernel and try if everything works? if it works, can you please send a pull request to remove jms serializer instantiation (and configuration, if there is any in app/config/config.yml)?

alexseif commented 8 years ago

So I cloned master and removed the bundle registration in AppKernel, than I ran composer install to test the app I got

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

[InvalidArgumentException]

  Neither a service called "jms_serializer.serializer" nor "serializer" is available and no serializer is explicitly configured. You must either enable the JMSSerializerBundle, enable the FrameworkBundle serializer or configure a custom serializer.  

So I ran it again with composer remove jms/serializer same result I'm not very good at this, and I still didn't get into symfony services, but I'd like to help, if you wanna let me know what to do next.

I got it running with composer require jms/serializer, but I think that defies the goal

wouterj commented 8 years ago

Looking at the message, I think it comes from the FOSRestBundle.

If you're on Symfony 2.7+, try enabling the serializer of the FrameworkBundle:

# app/config/config.yml
framework:
    # ...
    serializer: true
alexseif commented 8 years ago

Although I'm no longer using this repo. It was just a try out, I'll test it and send a pull request on success. Thank you for your help:)

alexseif commented 8 years ago

Thank you @WouterJ , that worked I did https://github.com/symfony/symfony-standard/pull/924

alexseif commented 8 years ago

Ok, I think I was finally able to make a proper pull request https://github.com/symfony-cmf/standard-edition/pull/47

dbu commented 8 years ago

yep, worked. thanks a lot @alexseif !

remmel commented 8 years ago

Thanks, work for me as well

frapsoft commented 8 years ago

today i ran in the same problem while installing symfony cmf with composer:

#> composer create-project symfony-cmf/standard-edition scmf

failed with this error:

`Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception

[RuntimeException] An error occurred when executing the "'cache:clear --no-warmup'" command: Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Class 'JMS\Seriali zerBundle\JMSSerializerBundle' not found in /web/scmf/app/Ap pKernel.php:38`

Simple fix for this problem:

#> composer require jms/serializer-bundle

maybe helps someone having the same issue ...

InnekeVM commented 8 years ago

I'm having the same issue, but the fix from @frapsoft worked. I assume this should be fixed in the repository by updating the composer.json file?

wouterj commented 8 years ago

Indeed, I only just realized we didn't yet fix this in the 1.2 branch (only in the master branch). I've pushed a commit to fix this (https://github.com/symfony-cmf/standard-edition/commit/e1ce1e5d43761a6089158bad62266961f031b533) and will release a new 1.2 version once the build passes.

wouterj commented 8 years ago

Released https://github.com/symfony-cmf/standard-edition/releases/tag/1.2.1