laravel Composer无法在Iran下载和安装软件包

kmpatx3s  于 2022-11-18  发布在  其他
关注(0)|答案(1)|浏览(171)

我住在伊朗,在过去的日子里,因为互联网的限制,我不能推到GitHub或GitLab,也不能使用 composer 。
对于GitHub和GitLab,我尝试了SSH连接和SSH访问密钥,还没有问题!但是我不能使用Composer。
当我尝试这个
composer create-project laravel/laravel starter-app
我明白了

Creating a "laravel/laravel" project at "./starter-app"
Info from https://repo.packagist.org: #StandWithUkraine
Cannot use laravel/laravel's latest version v9.3.8 as it requires PHP ^8.0.2 which is not satisfied by your platform.
Installing laravel/laravel (v8.6.12)
  - Downloading laravel/laravel (v8.6.12)
  - Downloading laravel/laravel (v8.6.12)
  - Downloading laravel/laravel (v8.6.12)
  - Downloading laravel/laravel (v8.6.12)
    Failed to download laravel/laravel from dist: curl error 28 while downloading https://codeload.github.com/laravel/laravel/legacy.zip/843a4f81eb25b88b225a89d75a2d3c274e81be6b: Operation timed out after 10000 milliseconds with 0 out of 0 bytes received
    Now trying to download from source
  - Syncing laravel/laravel (v8.6.12) into cache
Cloning failed using an SSH key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+DESKTOP-RRHGV12+2022-10-11+1350 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+DESKTOP-RRHGV12+2022-10-11+1350
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "C:/Users/VIRA-PC03/AppData/Roaming/Composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):

我转到此链接“https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth“并生成新令牌并粘贴它,但没有任何React,而且我无法使用composer
我还尝试了composer diagnose命令,得到了

Checking platform settings: OK
Checking git settings: OK git version 2.29.2
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://api.github.com/: Operation timed out after 10000 milliseconds with 0 out of 0 bytes received
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: some number with spaces
Dev Public Key Fingerprint: some number with spaces
OK
Checking composer version: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://getcomposer.org/versions: Operation timed out after 10008 milliseconds with 0 out of 0 bytes received
Composer version: 2.4.2
PHP version: 7.4.12
PHP binary path: C:\xampp\php\php.exe
OpenSSL version: OpenSSL 1.1.1h  22 Sep 2020
cURL version: 7.70.0 libz 1.2.11 ssl OpenSSL/1.1.1h
zip: extension present, unzip not available, 7-Zip not available

然后我转到C:\users\AppData\Roaming\composer,创建文件“auth.json”并将其放入其中

{
    "github-oauth": {
        "github.com": "my token"
    }
}

但我无法使用Composer获得或安装Laravel或任何其他包(如phpspeadsheet)。

fkaflof6

fkaflof61#

我也有这个问题。你可以使用这个网站https://www.vpngate.net/来获得vpn。并使用vpn来更新 composer 。或者你可以复制供应商文件夹从其他项目和复制到您的项目。也#妇女生活自由

相关问题