Why i got error message in my composer after i run composer update in my composer.json: i update this require "yiisoft/yii2": ">=2.0.4", to "yiisoft/yii2": "dev-master", and then i want to change back to "yiisoft/yii2": ">=2.0.4"..i got this message:
anyone who know how fix this problem....
Probably you should run following command first to install the composer-asset-plugin:
php composer.phar global require "fxp/composer-asset-plugin:1.0.0"
You also need to add the following code to your project's composer.json file:
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
Related
Got "UnexpectedValueException" Your github oauth token for github.com contains invalid characters:"" while composer update on yii2 project.
When i was installing jui datetimepicker via composer, I have asked to give git token to install it. I had generated the token from GitLab and provide the token to terminal.I also change the composer.json file with token. But it gives me an error of "UnexpectedValueException" Your github oauth token for github.com contains invalid characters.
I have tried following solutions :
1) I have deleted my .git folder and tried to update composer still same issue
2) I have deleted the vendor and reinstall the composer not worked.
3) I have deleted the vendor and composer.json and put the previous vendor and composer.json file from my backup. but still get same issue.
4) I have tried to change the token from the following code :
composer config --global github-oauth.github.com <TOKEN>
5) Also put the following code in composer.json :
{
"config": {
"github-oauth": {
"github.com": "<TOKEN>"
}
}
}
Still same issue.
My composer.json file is as follows :
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Application Template",
"keywords": ["yii2", "framework", "advanced", "application template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"claudejanz/yii2-mygii": "dev-master",
"bower-asset/jquery": "#stable",
"bower-asset/jquery.inputmask": "#stable",
"bower-asset/punycode": "#stable",
"bower-asset/bootstrap": "#stable",
"3ch3r46/bootui-datepicker": "1.0.0",
"yiisoft/yii2-jui": "*",
"udokmeci/yii2-phone-validator" : "dev-master"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*"
},
"suggest": {
"codeception/codeception": "Codeception, 2.0.* is currently works well with Yii.",
"codeception/specify": "BDD style code blocks for PHPUnit and Codeception",
"codeception/verify": "BDD Assertions for PHPUnit and Codeception",
"yiisoft/yii2-faker": "Fixtures generator for Yii2 based on Faker lib"
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::setPermission"
]
},
"config": {
"process-timeout": 1800
},
"extra": {
"writable": [
"backend/runtime",
"backend/web/assets",
"frontend/runtime",
"frontend/web/assets"
],
"executable": [
"yii"
],
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
Please someone help.
I'm not sure what was the reason why it stopped working for you but as we discussed in comments the solution was to update the entry in auth.json that stores this GitHub token.
For everyone looking for this solution - auth.json is stored in your COMPOSER_HOME path. You can find this path by calling in the console
composer config -g data-dir
For more information about Composer configuration please refer to the Composer documentation at getcomposer.org.
I am using Laravel 5.4 with composer and when i try to install some requirement bash tells me:
Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.
Which is perfectly ok, illuminate/html is abandoned and i replaced it with the laravelcollective/html package in composer.json file, which is included in the following code snippet, but the problem is that even though illuminate/html is not present in composer.json file, it is installed when i issue the composer update command in console. I am very new to Laravel fw, but i also managed to remove illuminate/html from aliases and providers arrays in config/app.php file. I also tried several times manually removing illuminate/html folder from the vendor directory, which succeeded, but with new composer update it returns...
How can i delete this package and ensure, that it wont install itself next time i add new package with composer?
PS: I am not sure whether it has something to do with my problem, but i also had problem with post-update-cmd, which i replaced from previous "php artisan optimize" to "php customisan.php", where customisan.php will clear folder bootstrap/cache and all of its content.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"illuminate/support": "^5.4",
"laravel/framework": "5.4.*",
"laravel/passport": "^2.0",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.4.0",
"yajra/laravel-oci8": "^5.4"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php customisan.php"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}
If anyone experiences similar problem, #devk's answer should help.
All i had to do was issue composer update command in console.
Further explanation provided in #devk's answer...
I want to create yii2 project in windows 10. I use composer create-projectcommand truly, but I against with error.
Here is composer create-project command in Command Prompt:
And of course I get the same error in composer global require "fxp/composer-asset-plugin:~1.2.0":
I had no composer.json file in folder C:/Users/Mohammad/AppData/Roaming/Composer after installing composer-setup.exe, and I copied composer.json file from one of my projects in folder C:/Users/Mohammad/AppData/Roaming/Composer.
This is my composer.json in folder C:/Users/Mohammad/AppData/Roaming/Composer:
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.6",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"franciscomaya/yii2-sceditor": "dev-master",
"kartik-v/yii2-widget-sidenav": "*",
"mohammad-mahdy/yii2-jdate": "*",
"2amigos/yii2-ckeditor-widget" : "*",
"2amigos/yii2-gallery-widget": "~1.0",
"romka-chev/yii2-swiper" : "*",
"kartik-v/yii2-widgets": "*",
"kartik-v/yii2-grid": "#dev",
"yiisoft/yii2-imagine": "*",
"omnilight/yii2-shopping-cart": "*",
"fxp/composer-asset-plugin": "^1.0"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
Please help me to fix it.
I have no problems in installing yii2 project using composer in my windows 10 system. Delete the folder basic or yii2Basic inside C:\xampp\htdocs and follow these steps for smooth installation.
Check composer is installed on your system. You can check this by typing composer in your command line and hitting enter. If composer is successfully installed you will see a screen like this.
Next step is to install the Composer Asset Plugin.Before that you need to remove the folder composer from C:/Users/Mohammad/AppData/Roaming/Composer if one is there.Then Run the following command to install it.
composer global require "fxp/composer-asset-plugin:~1.2.0"
Now navigate to the directory you wish to maintain your source code.In your case it would be
cd C:\xampp\htdocs
Now to install the basic application template run the command below.
composer create-project yiisoft/yii2-app-basic basic 2.0.10
In the process you might see a screen as given below asking you to input token.
This is normal just login to your github account and paste the url given to generate the token.The copied token is then pasted for the installation to continue.Sometimes you might be asked to enter your github username and password,these are normal just follow the steps and you are ready to go.
If still the problem persists check the contents inside of your composer.json
Contents inside my composer.json is given below
{
"require": {
"fxp/composer-asset-plugin": "^1.2.0"
}
}
Go to the folder:
C:/Users/Mohammad/AppData/Roaming/Composer
and edit the composer.json file.
Make sure there are no unnecessary entries (like non-global packages).
For example my global composer.json looks like this:
{
"require": {
"fxp/composer-asset-plugin": "1.2.0",
"codeception/codeception": "^2.2"
}
}
After removing what should not be there save it and run in console
composer global update
There is a chance you have installed some package like Yii 2 globally and that is why you get this error.
If this goes fine you can go to the project folder and retry to install Yii 2 (don't use global when installing local project like this).
If you don't want to use plugin to create Yii2 project, you could try fixed Bower one:
Basic Template:
composer create-project --prefer-dist yidas/yii2-app-basic
Advanced Template
composer create-project --prefer-dist yidas/yii2-app-advanced
With fixed Bower vendor, which could prevent your Composer error.
Refer yidas/yii2-composer-bower-skip
i having the problem with updating extinctions through composer on local windows 7 machine.
i just want to add
"kartik-v/yii2-widget-datepicker": "#dev"
in composer.json file.
after adding this line of code and giving command to update on cmd as..
composer update
its showing me following error message on cmd line.. please see this one..
i just change code in composer "minimum-stability": "stable",
to `"minimum-stability": "dev",
as i got solution from stackoverflow so i tried but not work for me.
my whole composer code is here..
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.6",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*",
"kartik-v/yii2-widget-datepicker": "#dev"
},
"config": {
"process-timeout": 1800
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
please help... it will be a great appreciation for me.
Thanking you in advanced.
Try this in cmd
php composer.phar update
Run this command
php composer.phar global require "fxp/composer-asset-plugin:1.0.0"
Then run your command
You should run the following command first:
composer global require "fxp/composer-asset-plugin:1.0.0"
Try with this
composer selfupdate
This is correct way to install last version.
composer global require "fxp/composer-asset-plugin:~1.1"
I'm trying to install to install the Gedmo Doctrine2 extensions in Symfony2 to use the translate composante.
I found a page online that show me how to do it (https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/symfony2.md), but I'm not shure about a few things.
First, when I change the composer.json file, I noticed that I have
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
And the instruction tells me to add
"psr-0": {
"Acme": "src/"
}
I don't know if I need to change the "": "src/", ligne or if I add the new ligne, or if I just let it be like it is.
I would really help me if someone juste tell what my file should looks like, so here is my composer.json:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
"doctrine/dbal": "<2.5",
"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": "~3.0,>=3.0.12",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"sensio/generator-bundle": "2.0.*",
"jms/security-extra-bundle": "1.0.*",
"gedmo/doctrine-extensions": "dev-master",
"incenteev/composer-parameter-handler": "~2.0",
"ircmaxell/password-compat": "^1.0"
},
"require-dev": {
"sensio/generator-bundle": "~2.3"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"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",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"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",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.6-dev"
}
}
}
The other thing is that after that step, I need to run php composer.phar update gedmo/doctrine-extensions in composer, but I don't have a a composer.phar file, so I did insted composer update.
Is that O.K., or I need to do an other line?
You can simply use
composer require gedmo/doctrine-extensions
and the composer.json will be automatically modified.
Regarding "composer" vs "composer.phar": yes, they are the same, so you can use whatever you have.
To add more details: usually everyone rename "composer.phar" to "composer" and move it to a binaries location on the os (i.e. /usr/local/bin on Linux) so that it can be used as a common system command. That is probably your situation.
The instruction is unclear, you do not need to change the line
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
Just add "gedmo/doctrine-extensions": "dev-master" to the require section.
Then to run a composer update you should install composer if you have not yet done so (but if you have symfony installed, I think you do unless you followed the instructions in the tutorial in which case I would reinstall symfony the official way as the tutorial refers to an outdated repository)