Composer下载Laravel遇到的坑
composer global require laravel/installer
1.curl erroe 60错误
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.laravel-china.org"
}
}
替换为
"repositories": {
"packagist": {
"type": "composer",
"url": "https://mirrors.aliyun.com/composer/"
}
}
2.curl error 28 错误
按网上的解决办法是更改镜像位置:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
但是这个更改方法与上述无异,但还是会在下载中出现:
Failed to download symfony/console from dist: curl error 28 while downloading https://api.github.com
这个是单项下载中出现的问题,最后使用科学上网,install多几次就成功下载
3.git报错问题——下载最后红色框出现
1) CAfile: C:\EXE\Git\mingw64\sslcert.pem CApath: none
很明显这个是路径没有找到,不难看出是路径上少了个’’
首先进入:.gitconfig
直接在cmd终端或者git bash中输入
git config --gobal --edit
直接打开vsc中便可直接修改,再次运行便没有出现错误
.gitconfig
[core]
editor = \"C:\\vscode\\Microsoft VS Code\\bin\\code\" --wait
[http]
postBuffer = 524288000
sslVerify = true
sslBackend = openssl
#以下源代码为:"sslCAInfo = C:\\EXE\\Git\\mingw64\\sslcert.pem"
sslCAInfo = C:\\EXE\\Git\\mingw64\\ssl\\cert.pem
[remote "origin"]
proxy =
2)Cloning into… fatal: unable to access… error setting certificate verify locations:
这个应该是证书验证错误,推荐方法
1.暴力解决-直接取消认证
git config --global http.sslverify "false"
2.指定证书的路径-根据错误提示的CAfile信息加载证书路径
sudo git config --system http.sslCAinfo ***.crt
3)Failed to connect to github.com port 443 after 21098 ms: Timed out
原因: 这样的问题往往是由于网络慢访问超时,这时候我们可以在终端选择使用设置代理和取消代理的命令解决。
设置代理:
git config --global https.proxy
取消代理:
git config --global --unset https.proxy
4.Cloning failed using an ssh key for authentication, enter your GitHub credentials
Token(hidden):
首先到https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+服务器名称+2018-07-08+0803这个地址重新生成一下token
点击最下方的:
复制就好,接着打开 C:\Users\***\AppData\Roaming\Composer\auth.json
{
"bitbucket-oauth": {},
"github-oauth": {
// 在这里输入token值
"github.com": "ghp_q**************"
},
"gitlab-oauth": {},
"gitlab-token": {},
"http-basic": {
},
"bearer": {}
}
或者直接再终端输入:
5.Composer:Failed to execute git clone --mirror
composer install时,composer存在非开源依赖,账号无权限等
此问题可能存在的原因:
ssh设置的已经被踢除,请替换正确的
composer依赖中设定了指定的账号密码
解决办法:
打开 C:\Users***\AppData\Roaming\Composer\auth.json
{
"bitbucket-oauth": {},
"github-oauth": {
// 在这里输入token值
"github.com": "ghp_****************"
},
"gitlab-oauth": {},
"gitlab-token": {},
"http-basic": {
"gitlab.com.cn": {
"username": "diary*",
"password": "***********"
}
},
"bearer": {}
}
最终也是黄天不负有心人,成功安装