1、执行 composer require 时,报错:[Composer/Downloader/TransportException] curl error 6 while downloading https://api/v4/projects/%2Fnova: Could not resolve host: api 。如图1
PS E:/wwwroot/wshop/platform> composer require nuwave/lighthouse easywechat-composer/easywechat-composer contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins Do you trust "easywechat-composer/easywechat-composer" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] d The following exception probably indicates you are offline or have misconfigured DNS resolver(s) [Composer/Downloader/TransportException] curl error 6 while downloading https://api/v4/projects/%2Fnova: Could not resolve host: api require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]... PS E:/wwwroot/wshop/platform>
2、查看 composer.json 文件,其中包含 nova 相关的配置项。
"repositories": [ { "type": "gitlab", "url": "https://git.xxx.com/xgrit/nova" } ],
3、新建文件:C:/Users/Lenovo/AppData/Roaming/Composer/auth.json。具体值需要自行设置。如图2
{ "gitlab-token": { "git.xxx.com": "xxxxxxxxxx" }, "gitlab-domains": [ "git.xxx.com" ] }
4、再次执行 composer require 时,不再报错。如图3
PS E:/wwwroot/wshop/platform> composer require nuwave/lighthouse easywechat-composer/easywechat-composer contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins Do you trust "easywechat-composer/easywechat-composer" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] d Using version ^5.33 for nuwave/lighthouse ./composer.json has been updated easywechat-composer/easywechat-composer contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins Do you trust "easywechat-composer/easywechat-composer" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] d Running composer update nuwave/lighthouse Loading composer repositories with package information Updating dependencies Lock file operations: 5 installs, 0 updates, 0 removals - Locking haydenpierce/class-finder (0.4.3) - Locking laragraph/utils (v1.1.1) - Locking nuwave/lighthouse (v5.33.1) - Locking thecodingmachine/safe (v1.3.3) - Locking webonyx/graphql-php (v14.11.3) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 5 installs, 0 updates, 0 removals - Downloading webonyx/graphql-php (v14.11.3) - Downloading thecodingmachine/safe (v1.3.3) - Downloading laragraph/utils (v1.1.1) - Downloading haydenpierce/class-finder (0.4.3) - Downloading nuwave/lighthouse (v5.33.1) - Installing webonyx/graphql-php (v14.11.3): Extracting archive - Installing thecodingmachine/safe (v1.3.3): Extracting archive - Installing laragraph/utils (v1.1.1): Extracting archive - Installing haydenpierce/class-finder (0.4.3): Extracting archive - Installing nuwave/lighthouse (v5.33.1): Extracting archive 4 package suggestions were added by new dependencies, use `composer suggest` to see details. Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested. Package moontoast/math is abandoned, you should avoid using it. Use brick/math instead. Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested. Generating optimized autoload files > Google/Task/Composer::cleanup Class Tests/Feature/LoginApiPostCartPaymentTest located in E:/wwwroot/wshop/platform/tests/Feature/ApiCartPaymentTest.php does not comply with psr-4 autoloading standard. Skipping. Class Tests/Feature/LoginApiPostCartTest located in E:/wwwroot/wshop/platform/tests/Feature/ApiCartTest.php does not comply with psr-4 autoloading standard. Skipping. Class Tests/Feature/LoginGetPaymentTest located in E:/wwwroot/wshop/platform/tests/Feature/PaymentTest.php does not comply with psr-4 autoloading standard. Skipping. Class Sofa/Eloquence/Searchable/Searchable located in E:/wwwroot/wshop/platform/vendor/sofa/eloquence-base/src/Contracts/Searchable/Searchable.php does not comply with psr-4 autoloading standard. Skipping. Class Modules/RecommendedProduct/Database/Seeders/LastSaleDatabaseSeeder located in E:/wwwroot/wshop/platform/Modules/LastSale/Database/Seeders/LastSaleDatabaseSeeder.php does not comply with psr-4 autoloading standard. Skipping. Class Modules/CheckoutPageImage/Database/Seeders/PixelConversionDatabaseSeeder located in E:/wwwroot/wshop/platform/Modules/PixelConversion/Database/Seeders/PixelConversionDatabaseSeeder.php does not comply with psr-4 autoloading standard. Skipping. Class Modules/ThemeSetting/Tests/Functional/GraphQl/ThemeSettingGraphQlApiTest located in E:/wwwroot/wshop/platform/Modules/ThemeStore/Tests/Functional/GraphQl/ThemeSettingGraphQlApiTest.php does not comply with psr-4 autoloading standard. Skipping. Class Modules/ThemeStore/Tests/FactoryTest located in E:/wwwroot/wshop/platform/Modules/ThemeStore/Tests/Unit/FactoryTest.php does not comply with psr-4 autoloading standard. Skipping. > Illuminate/Foundation/ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi Discovered Package: arubacao/asset-cdn Discovered Package: axlon/laravel-postal-code-validation Discovered Package: barryvdh/laravel-debugbar Discovered Package: beyondcode/laravel-dump-server Discovered Package: beyondcode/laravel-er-diagram-generator Discovered Package: boaideas/laravel-cli-create-user Discovered Package: cviebrock/eloquent-sluggable Discovered Package: dingo/api Discovered Package: fideloper/proxy Discovered Package: genealabs/laravel-model-caching Discovered Package: igaster/laravel-theme Discovered Package: ignited/laravel-omnipay Discovered Package: intervention/image Discovered Package: jenssegers/agent Discovered Package: jgrossi/corcel Discovered Package: laravel/passport Discovered Package: laravel/scout Discovered Package: laravel/socialite Discovered Package: laravel/tinker Discovered Package: laravel/ui Discovered Package: maatwebsite/excel Discovered Package: mpociot/laravel-apidoc-generator Discovered Package: nesbot/carbon Discovered Package: newshop/facebook-conversions-api Discovered Package: nunomaduro/collision Discovered Package: nuwave/lighthouse Discovered Package: nwidart/laravel-modules Discovered Package: orangehill/iseed Discovered Package: overtrue/laravel-pinyin Discovered Package: overtrue/laravel-wechat Discovered Package: s-ichikawa/laravel-sendgrid-driver Discovered Package: sentry/sentry-laravel Discovered Package: socialiteproviders/manager Discovered Package: sofa/eloquence-base Discovered Package: sofa/eloquence-mutable Discovered Package: spatie/laravel-activitylog Discovered Package: spatie/laravel-permission Discovered Package: spatie/laravel-query-builder Discovered Package: spatie/laravel-sitemap Discovered Package: tamayo/laravel-scout-elastic Discovered Package: torann/geoip Package manifest generated successfully. 116 packages you are using are looking for funding. Use the `composer fund` command to find out more! PS E:/wwwroot/wshop/platform>
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250702.html