Spea / SpBowerBundle

Symfony2 Bundle to handle asset dependencies with bower
231 stars 44 forks source link

Cached dependencies for $file not found, create it with the method createDependencyMappingCache(). #21

Closed tarjei closed 11 years ago

tarjei commented 11 years ago

Hi,

When I run app/console cache:clear, I get:

[Sp\BowerBundle\Bower\Exception\RuntimeException] [exec] Cached dependencies for "/var/lib/jenkins/jobs/TestUndervisningflate/workspace/app/cache/tes_/sp_bower" not found, create it with the method createDependencyMappingCache(). [exec]

I got the following bower config:

sp_bower:
    bin: %kernel.root_dir%/Resources/node_modules/.bin/bower
    install_on_warmup: true
    assetic: ~
    bundles:
        MyBundle: ~

also in composer I got:

dependency: "sp/bower-bundle": "*"


 "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sp\\BowerBundle\\Composer\\ScriptHandler::bowerInstall"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sp\\BowerBundle\\Composer\\ScriptHandler::bowerInstall"
        ]
    },
Spea commented 11 years ago

I will take a closer look over the weekend.

tarjei commented 11 years ago

The odd thing is that this does not happen if I first delete the app/cache/dev directory.

I'm trying to recreate the bug now.

tarjei commented 11 years ago

Grr, cannot recreate anymore.

Closing bug :) Sorry for the noise.

tarjei commented 11 years ago

Aha, now I managed to recreate the bugger.

The fun happens in Bower/Bower.php: createDependencyMappingCache(): See: https://github.com/Spea/SpBowerBundle/blob/master/Bower/Bower.php#L88

If bower list --map returns an empty result for some reason, the cache is deleted but this is not viewed as an error, thus the process continues - but without a cache key. This causes a fatal error down the line.

tarjei commented 11 years ago

Ok, I think I've understood the problem completely.

It starts with bower returning an empty string -> which IMHO should cause some kind of error in SPBowerBundle.

But the reason for this is that I was running an old node version on the box. This is now upgraded and then bower works.

So in the end:

  1. make an empty return string from bower a fatal error.
  2. Note that you need a recent node version to use this bundle :)
Spea commented 11 years ago

Yeah you are right, an error/exception makes more sense. I already changed this so now you will get an MappingException when bower returns an invalid mapping. Thanks for reporting and reproducing this issue ;)

eymengunay commented 11 years ago

Same error here, bower returns an empty output. Here is a detailed info on environment. Hopefully it can serve to someone else:

OS: CentOS 6.4 Node version: 0.10.4 (installed via yum) Bower version: 0.9.1 (the same also with 0.9.2)

Removing node and installing manually resolved the empty output error.