Home  >  Article  >  PHP Framework  >  Composer failed to install yii2

Composer failed to install yii2

王林
王林Original
2019-11-05 09:28:003048browse

Composer failed to install yii2

Cause 1: The download speed is slow, mainly due to network problems

Solution:

1. FANQIANG, the method is baidu or google

2. Use domestic mirror

The second method is more reliable, and specifying the mirror is also very simple, just one command:

composer config -g repo.packagist composer https://packagist.phpcomposer

This command will modify the config.json file under the composer main folder and configure Write the information in. If you want to know where the composer home folder is installed, you can execute the composer config -l -g command, and then view the home information. Of course, this command can also view other configuration information.

Cause two: There are only template files under the folder but no vendor

The above prompt message does not clearly indicate where the problem occurs, but it gives There are two potential reasons:

1. The package name is entered incorrectly. The specific package name is not specified. This information is not reliable;

2. This information is relatively Useful, the general idea is that composer cannot obtain the package under the existing version based on the existing configuration.

Solution:

You can guess that composer needs to be updated or the plug-in needs to be updated, so execute composer self-update to update composer , and then continue composer update to pull the package, but the above error is still prompted.

Then update (install) the plug-in and execute the composer global require "fxp/composer-asset-plugin:~1.1.2" command. You can make corresponding changes according to the version update on the official website. This command will Install it under the vendor folder under the composer's main folder, and write the configuration information in composer.json under the main folder.

Recommended tutorial: yii tutorial

The above is the detailed content of Composer failed to install yii2. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn