我正在尝试安装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
我的composer.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"
}
}
}
答案 0 :(得分:0)
好吧,如果你查看source code,你会发现错误来自库无法在你的系统中找到它,特别是我假设this行因为windows不能而失败没有which
命令。
我猜测解决方案是直接在项目目录中使用composer.phar
文件。
答案 1 :(得分:0)
如果检查twbs / bootstrap包,您可能会发现它已经安装了transition.js,但mopabootstrapbundle base.html.twig请求bootstrap-transition.js。如果是这种情况,我认为您将不得不重命名脚本或编辑base.html.twig。我有twitter / bootstrap,其中包含bootstrap-transition.js,所以我调整了符号链接。 我不确定包裹实际给了我什么。