YII2 update vendor error

简介:

今天周六,在家安装yii2的advanced版本, 过程有些坎坷, 不过最后总算安装好了.

总结一下, 主要遇到下面两个问题:

1, 下载速度慢, 主要原因是网络问题

下载yii2时, 模板(除了vendor之外的文件夹和文件)一般会很快下载下来,

但是vendor文件夹下都是yii2依赖的包, 这些包好像都存放在国外的github上, 所以下载会很慢, 有时甚至下载不下来.

这个比较好解决, 方法一: FANQIANG, 方法baidu或者google即可. 方法二: 采用国内的镜像.

第二种方法更可靠, 而且指定镜像也很简单, 具体可参考Composer中国全量镜像http://pkg.phpcomposer.com/

官方说明. 在这里写出来吧, 一条命令就可以: composer config -g repo.packagist composer https://packagist.phpcomposer.

这条命令就会修改composer主文件夹下面的config.json文件, 将配置信息写进去.

如果你想知道composer主文件夹安装在哪儿, 可以执行composer config -l -g这条命令, 然后查看home信息,

当然这条命令还可以查看其它配置信息.

2, 速度没有问题, 执行安装命令后, 发现文件夹下面只有模板文件没有vendor

composer提示:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable
| 1.11.*@stable -> no matching package found.
- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stabl
e -> no matching package found.
- Installation request for yiisoft/yii2 >=2.0.6 -> satisfiable by yiisoft/yi
i2[2.0.6, 2.0.7].

Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more det
ails.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further commo
n problems.

上面的提示信息中其实并没有很明确的指出问题出现在哪儿, 但是它给出了两个潜在的原因:

  - 1, package name包名输入错误, 具体是哪个包名错误没有说明, 这个信息不太靠谱.

  - 2, 这条信息比较有用, 大意是composer根据现有的配置在现有版本下无法获取到包,

  可以猜测下, 大概是composer需要update或者插件需要更新了.

于是执行composer self-update更新composer, 然后再接着composer update拉包,但是仍是提示上面的错误.

那就接着更新(安装)插件, 在这个网站下https://packagist.org/packages/fxp/composer-asset-plugin可以看到

composer-asset-plugin的最新版本, 然后执行composer global require "fxp/composer-asset-plugin:~1.1.2"

我安装时最新版本为1.1.2, 可以根据官网的版本更新来做相应更改.这条命令会将插件安装到composer主文件夹下的vendor

文件夹下面, 并在主文件夹下的composer.json写入配置信息.

解决了上面两个问题, 总算将yii2安装成功.

总结:

yii2安装问题不是很多, 遇到问题先要找到原因, 多看下yii官网的下载或者安装指南, 然后多百度或者google.



本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/1853237
相关文章
|
NoSQL PHP Redis
Laravel Predis Error while reading line from the server.
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_21158419/article/details/53610445 问题...
3785 0
|
9月前
|
PHP
thinkphp报错Call to undefined method app\index\controller\Index::fetch()
thinkphp报错Call to undefined method app\index\controller\Index::fetch()
91 0
|
9月前
|
JavaScript
解决npm ERR! Cannot read properties of null (reading ‘pickAlgorithm‘)报错问题
在vue项目中,使用npm i 命令安装node modules时,出现报错。
|
11月前
|
缓存 JavaScript Nacos
Vue 报错整理:npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jinchuang\AppData...
我是在npm install的时候出现的这个问题,开始是安装不上,提示升级npm,然后我按要求升级npm i npm 依然报错 解决方法:1. 删除本地node_modules 依赖包2. 执行 npm cache clean --force 清理缓存3. npm install。
172 0
|
安全 前端开发 PHP
yii2.0里面的HtmlPurifier::process是干什么的?
yii2.0里面的HtmlPurifier::process是干什么的?
208 0
|
缓存 PHP 开发工具
Composer 更新时报错:PHP Fatal error: composerRequireac6b4…(): Failed opening required ‘…/src/helpers.php
Composer 更新时报错:PHP Fatal error: composerRequireac6b4…(): Failed opening required ‘…/src/helpers.php
180 0
Composer 更新时报错:PHP Fatal error:  composerRequireac6b4…(): Failed opening required ‘…/src/helpers.php
ERROR: libass not found using pkg-config2
ERROR: libass not found using pkg-config2
101 0
ERROR: libass not found using pkg-config
ERROR: libass not found using pkg-config
109 0
|
前端开发
前端项目实战2-npm WARN config global --global, --local are deprecated. Use `–location解决方案
前端项目实战2-npm WARN config global --global, --local are deprecated. Use `–location解决方案
599 0
|
PHP
【laravel报错】You don‘t have permission to access /laravel/public/index.php on this server.
【laravel报错】You don‘t have permission to access /laravel/public/index.php on this server.
98 0
【laravel报错】You don‘t have permission to access /laravel/public/index.php on this server.