MopaBootstrapBundle Could not find composer.phar - php

I'm trying to install the MopaBootstrapBundle, I created a view with the following code:
{% extends 'MopaBootstrapBundle::base.html.twig' %}
{% block title %}Yourapp{% endblock %}
{# and define more blocks ... #}
but when I navigate to that view I get the following exception:
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".
I believe this may be due to not being able to install LESS, I get the following error:
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]
Even though I have composer installed and it works when I do the following:
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
My 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"
}
}
}

Well, if you look at source code, you'll see that the error comes from library not able to find it in your system, specifically I'm assuming that this line fails because windows doesn't have which command.
I'm guessing the solution would be to use composer.phar file directly in project directory.

If you examine the twbs/bootstrap bundle you might find that it has installed, among other scripts, transition.js but mopabootstrapbundle base.html.twig requests bootstrap-transition.js. If this is the case I think you're going to have to rename the scripts or edit base.html.twig. I had twitter/bootstrap, which contains bootstrap-transition.js installed, so I adjusted the symlink.
I'm not sure what the package actually gives me.

Related

Vendor updates broke FOS User Bundle with "Call to a member function has() on a non-object"

I updated my vendors for a Symfony 2.8 project and suddenly the login page isn't loading – instead I get this:
Error: Call to a member function has() on a non-object in
vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
at line 184
"name": "hazardlog",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
"repositories": [
{
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "1.11.1",
"dist": {
"url": "https://code.jquery.com/jquery-1.11.1.js",
"type": "file"
}
}
}
],
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"braincrafted/bootstrap-bundle": "~2.0",
"twbs/bootstrap": "3.0.*",
"jquery/jquery": "1.11.*",
"hwi/oauth-bundle": "^0.5.0",
"friendsofsymfony/user-bundle": "~2.0#dev",
"stephanecollot/datetimepicker-bundle": "dev-master"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"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-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
}
}
I have seen this sort of question several times but I could not find one with an accepted answer and explanation. So here goes.
The basic problem lies with:
"friendsofsymfony/user-bundle": "~2.0#dev",
Back when Symfony 2.8/3.0 was first released, the stable 1.x version of FOSUserBundle no longer worked. The 2.x version has been in development for years with no actual road map in sight for when it would be stabilized. So the development branch was hacked up to get it working. And folks had no choice but to use it which of course is dangerous because you never know when a development change might in fact break your code.
Time went by and eventually a stable 2.x version of the FOSUserBundle was released. However, quite a few developers never got around to updating their dependencies and continued to use the master branch.
Fast forward to the present. The release of Symfony 4 has now triggered a fair amount of development in the master branch. Development which is introducing breaking changes to existing 2.8 (and probably 3.0) code.
The bottom line is to use a stable branch with:
"friendsofsymfony/user-bundle": "~2.0",
followed by a composer update.
For those using Symfony 3.2, it looks like version "~2.1" throws same error along with the OP's version "~2.0#dev".
This worked:
"friendsofsymfony/user-bundle": "2.0"
Keeping it at 2.0 did the trick for me.
had a problem like this here but solved,i just did the opposite of this.
i had:
"friendsofsymfony/user-bundle": "^2.1",
in my composer.json file which give me a Call to a member function has() on null error to solve this i Actually add "#dev it became:
"friendsofsymfony/user-bundle": "^2.1#dev",
then updated my composer with :
composer update

Error: Undefined class constant 'END_OF_MAINTENANCE' Symfony 2

I'm developing the functions of an existing project.
The project is developed using Symfony 2. And I created a virtual host Apache (Ubuntu and LAMP) to turn it. When the boot gives me this error.
"FatalErrorException in ConfigDataCollector.php line 276: Error: Undefined class constant 'END_OF_MAINTENANCE'". I can not update the composer because if I would do when I would do after "git push" to the master should also load the new libraries (packages) and does not need it because the site run well with this version of the composer.
Then another thing:
it is normal that when I delete brutally cache symfony to understand (/ project / app / cache), when after loading the page of my project, Apache is to write with your permissions on the folder so I can not do php app / console cache: clear. I wanted to know if it is a problem that affects the other or not.
One other thing the same thing that happens to / project / app / cache happens with / project / app / logs.
I am attaching the composer.
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "~2.0#dev",
"facebook/php-sdk": "3.2.0",
"friendsofsymfony/facebook-bundle": "dev-master",
"friendsofsymfony/jsrouting-bundle": "#stable",
"mattketmo/email-checker": "~1.0",
"hwi/oauth-bundle": "0.4.*#dev",
"suncat/mobile-detect-bundle": "0.10.*"
},
"require-dev": {
"phpdocumentor/phpdocumentor": "2.*"
},
"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"
],
"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"
]
},
"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.4-dev"
}
}
}
Thanks a lot

Symfony 2 web directory rename

I have a Symfony 2 project and I cant rename the web dir for some reasons. I am trying to rename it to public.
According to the manual, I am suppose to change the composer.json and make sure the links in app.php and app_dev.php is correct.
But when I run app/console server:run, it shows
The given document root directory "C:/xampp/htdocs/xxx/app/../web" does nto exists.
I have changed the composer.json, run composer install and composer update but still no luck. Here is my composer.json , as you can see I have already added "symfony-web-dir": "public" to the file.
If I rename my public folder to web, then everything is fine, but for certain reasons I can't do that.
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"richsage/rms-push-notifications-bundle": "dev-master",
"friendsofsymfony/user-bundle": "~1.3",
"ircmaxell/password-compat": "~1.0.3"
},
"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"
],
"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"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "public",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.4-dev"
}
}
}
You can indeed change the name of the 'web' directory, but the server:run command does not expect this. As you can see in the ServerRunCommand source code (on line 77), the 'web' directory is hard-coded in there.
However, you should be able to solve this by simply providing the --docroot option when running the command:
bin/console server:run --docroot=C:/xampp/htdocs/xxx/public
(replace bin/console with the location of the console, which may be app/console if you are using the Symfony 2 structure)

Error in attempting to create a bundle within symfony2

I have installed symfony2 and i have ensured the application has been installed correctly and i am trying to create a bundle for my project and i seem to be getting this message and i have edited the composer.json manually and added the correct bundle to the file:
Generating the bundle code: OK
Checking that the bundle is autoloaded: FAILED
Confirm automatic update of your Kernel [yes]? yes
Enabling the bundle inside the Kernel: OK
Confirm automatic update of the Routing [yes]? yes
Importing the bundle routing resource: OK
i have ensured composer has been configured correctly and i have removed previous namespaces from appkernel.php and routing.yml any help would be much appreciated.
this is my composer.json file:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": {
"Acme": "src/"
}
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0"
},
"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"
],
"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"
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.4-dev"
}
}
}
I also encountered the same problem while generating my first bundle. I did the following things:
1. Make sure you have Composer installed before generating a bundle.
2. If the same failure message occurs on generating bundles, then in the terminal type this in your project directory $ sudo composer dumpautoload -o.
This will run your application.

php composer.phar update failed - A typo in the package name

I have created a new Symfony 2.1 project and added a custom package downloaded by a SVN repo.
Now I'm tryng to upgrade the project to Symfony 2.2, but anytime I try to execute the command php ~/bin/composer.phar update the following error message appears:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package custom/utils could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
This is Symfony 2.2 composer.json:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"repositories": [
{
"type": "vcs",
"url": "svn+ssh://sources.de.ext/usr/local/svnroot/utils"
}
],
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.2.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.2.*",
"symfony/monolog-bundle": "2.2.*",
"sensio/distribution-bundle": "2.2.*",
"sensio/framework-extra-bundle": "2.2.*",
"sensio/generator-bundle": "2.2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
"custom/utils": "*"
},
"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"
],
"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"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "alpha",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"branch-alias": {
"dev-master": "2.2-dev"
}
}
}
Custom utils have following composer.json:
{
"name": "custom/utils",
"version": "1.0.0",
"description": "The Custom Libraries",
"autoload": {
"psr-0": {
"Blogo": "src/",
"WideImage": "lib/"
}
},
"require": {
"symfony/console": "2.*",
"symfony/yaml": "2.*"
}
}
Could anyone help me to understand what's wrong in new 2.2 Symfony? Because this error message appear only Symfony 2.2 upgrade.
Try running composer update --verbose or composer show custom/utils --verbose. Both will show you some output about the loading of your SVN repository. It should indicate which versions are loaded or not.
My guess is that you have a dev-trunk version available, and if you require it it will most likely work. You should not specify version: 1.0.0 in your composer.json, because composer reads the version information from tags/branches in your VCS.

Categories