0

我正在尝试安装 MopaBootstrapBundle,我使用以下代码创建了一个视图:

{% extends 'MopaBootstrapBundle::base.html.twig' %}

{% block title %}Yourapp{% endblock %}

{# and define more blocks ... #}

但是当我导航到该视图时,出现以下异常:

An exception has been thrown during the compilation of a template ("Unable to find file "@MopaBootstrapBundle/Resources/bootstrap/js/bootstrap-transition.js".") in "MopaBootstrapBundle::base.html.twig".

我相信这可能是由于无法安装 LESS,我收到以下错误:

C:\xampp\htdocs\Project>php app/console mopa:bootstrap:symlink:less
'which' is not recognized as an internal or external command,
operable program or batch file.
'which' is not recognized as an internal or external command,
operable program or batch file.



  [RuntimeException]
  Could not find composer.phar



mopa:bootstrap:symlink:less [-f|--force] [-m|--manual] [--no-symlink] [pathToTwi
tterBootstrap] [pathToMopaBootstrapBundle]

即使我安装了作曲家并且当我执行以下操作时它也可以工作:

C:\xampp\htdocs\Project>composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Updating the "app/config/parameters.yml" file.
Clearing the cache for the dev environment with debug true
Installing assets using the hard copy option
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
Installing assets for FL\FifaLeagueBundle into web/bundles/fifaleague
Installing assets for Mopa\Bundle\BootstrapBundle into web/bundles/mopabootstrap

Installing assets for Acme\DemoBundle into web/bundles/acmedemo
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodi
stribution
Checking Symlink ... OK

我的作曲家.json:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "jquery/jquery",
                "version": "1.9.1",
                "dist": {
                    "url": "http://code.jquery.com/jquery-1.9.1.js",
                    "type": "file"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "version": "master",
                "name": "twbs/bootstrap",
                "source": {
                    "url": "https://github.com/twbs/bootstrap.git",
                    "type": "git",
                    "reference": "master"
                },
                "dist": {
                    "url": "https://github.com/twbs/bootstrap/zipball/master",
                    "type": "zip"
                 }
            }
        }
    ],
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle": "~2.0@dev",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "doctrine/data-fixtures" : "dev-master",    
        "leafo/lessphp": "dev-master",
        "mopa/bootstrap-bundle": "dev-master",
        "twbs/bootstrap": "dev-master",
        "knplabs/knp-paginator-bundle": "dev-master",
        "knplabs/knp-menu": "2.0.*@dev",
        "knplabs/knp-menu-bundle": "dev-master",
        "craue/formflow-bundle": "dev-master"
    },
    "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",
            "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
        ],
        "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",
            "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "stable",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }

}
4

2 回答 2

0

如果您检查 twbs/bootstrap 包,您可能会发现它已经安装了 transition.js 以及其他脚本,但 mopabootstrapbundle base.html.twig 请求 bootstrap-transition.js。如果是这种情况,我认为您将不得不重命名脚本或编辑 base.html.twig。我安装了 twitter/bootstrap,其中包含 bootstrap-transition.js,因此我调整了符号链接。我不确定包裹实际上给了我什么。

于 2013-08-27T09:55:55.643 回答
0

好吧,如果您查看源代码,您会发现错误来自无法在您的系统中找到它的库,特别是我假设行失败是因为 windows 没有which命令。

我猜解决方案是composer.phar直接在项目目录中使用文件。

于 2013-08-25T19:21:50.160 回答