エラー内容
git cloneしたものを、MAMPで開発を進めようとし、php artisan serveとコマンドを打つと、以下のエラーが出てしまいました。
【前提】
Composer version 2.0.8
PHP 7.4.9
composer.json
1/Applications/MAMP/htdocs/nuriemon/composer.json 2{ 3 "name": "laravel/laravel", 4 "type": "project", 5 "description": "The Laravel Framework.", 6 "keywords": [ 7 "framework", 8 "laravel" 9 ], 10 "license": "MIT", 11 "require": { 12 "php": "^7.4", 13 "fideloper/proxy": "^4.2", 14 "fruitcake/laravel-cors": "^1.0", 15 "guzzlehttp/guzzle": "^6.3", 16 "jenssegers/agent": "^2.6", 17 "laravel/framework": "^7.0", 18 "laravel/tinker": "^2.0", 19 "laravel/ui": "^2.0", 20 "nexmo/laravel": "^2.2", 21 "square/square": "6.1.0.20200722", 22 "barryvdh/laravel-snappy": "^0.4.8" 23 }, 24 "require-dev": { 25 "barryvdh/laravel-ide-helper": "^2.8", 26 "facade/ignition": "^2.0", 27 "fzaninotto/faker": "^1.9.1", 28 "mockery/mockery": "^1.3.1", 29 "nunomaduro/collision": "^4.1", 30 "phpunit/phpunit": "^8.5" 31 }, 32 "config": { 33 "optimize-autoloader": true, 34 "preferred-install": "dist", 35 "sort-packages": true, 36 "secure-http": false 37 }, 38 "extra": { 39 "laravel": { 40 "dont-discover": [] 41 } 42 }, 43 "autoload": { 44 "psr-4": { 45 "App\": "app/" 46 }, 47 "classmap": [ 48 "database/seeds", 49 "database/factories" 50 ], 51 "files": [ 52 53 ] 54 }, 55 "autoload-dev": { 56 "psr-4": { 57 "Tests\": "tests/" 58 } 59 }, 60 "minimum-stability": "dev", 61 "prefer-stable": true, 62 "scripts": { 63 "post-autoload-dump": [ 64 "Illuminate\Foundation\ComposerScripts::postAutoloadDump", 65 "@php artisan package:discover --ansi" 66 ], 67 "post-root-package-install": [ 68 "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 69 ], 70 "post-create-project-cmd": [ 71 "@php artisan key:generate --ansi" 72 ] 73 }, 74 "repositories": { 75 "packagist": { 76 "type": "composer", 77 "url": "http://packagist.jp" 78 } 79 } 80} 81
#エラー内容
% nuriemon % php artisan serve In ProviderRepository.php line 208: Class 'Barryvdh\Snappy\ServiceProvider' not found
クラスがないとのことで、インストールしようとしましたが、以下のエラーが出てしまいました。
% composer require barryvdh/laravel-snappy Warning: Accessing packagist.jp over http which is an insecure protocol. [InvalidArgumentException] Could not find package barryvdh/laravel-snappy. Did you mean one of these? barryvdh/laravel-snappy jhosep32/laravel-report jimmyjs/laravel-report-generator coolsam/laravel-report-generator jimmyjs/pdf-report-generators
試したこと
■ 1.composer.jsonのsecure-http変更
/Applications/MAMP/htdocs/nuriemon/composer.json "config": { "secure-http": false }
参考:https://qiita.com/shinkuFencer/items/00c6cdbc0d0e0e081e38
■ 2.dump-autoload
% composer dump-autoload Generating optimized autoload files Class App\Http\Resources\AdvertisingResource located in ./app/Http/Resources/Manager/AdvertisingResource.php does not comply with psr-4 autoloading standard. Skipping. ocramius/package-versions: Generating version class... ocramius/package-versions: ...done generating version class > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi In ProviderRepository.php line 208: Class 'Barryvdh\Snappy\ServiceProvider' not found Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
参考:https://github.com/barryvdh/laravel-snappy/issues/140
■ 3.キャッシュ系
% php artisan config:cache In ProviderRepository.php line 208: Class 'Barryvdh\Snappy\ServiceProvider' not found % php artisan cache:clear In ProviderRepository.php line 208: Class 'Barryvdh\Snappy\ServiceProvider' not found
お力添えいただけると幸いです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。