前提・実現したいこと
Cakephpをインストールを試みてます。
macOS Catalina バージョン10.15.7
Vagrant (2.2.10)
Virtualbox6.1
Vagrantbox centos/7 2004.01
PHP 7.2.34
最後にcakePHPをGoogle Chromeで192.168.33.10/sampleと開こうとしたら、以下のようなエラーメッセージが出ました
発生している問題・エラーメッセージ
エラーメッセージ Warning: require(/var/www/html/sample/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/sample/webroot/index.php on line 31 Fatal error: require(): Failed opening required '/var/www/html/sample/vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/sample/webroot/index.php on line 31
試したこと
自分なりに調べて、composer dumpautoload とcomposer install というがあったので、ターミナルで記入したら、
Composer could not find a composer.json file in /var/www/html
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
というメッセージがでました。
フォルダにsampleにcomposer.jsonのファイルが入ってます。以下が中身です。
{ "name": "cakephp/app", "description": "CakePHP skeleton app", "homepage": "https://cakephp.org", "type": "project", "license": "MIT", "require": { "php": ">=7.2", "cakephp/cakephp": "~4.1.0", "cakephp/migrations": "^3.0", "cakephp/plugin-installer": "^1.3", "mobiledetect/mobiledetectlib": "^2.8" }, "require-dev": { "cakephp/bake": "^2.0.3", "cakephp/cakephp-codesniffer": "~4.2.0", "cakephp/debug_kit": "^4.1", "josegonzalez/dotenv": "^3.2", "phpunit/phpunit": "~8.5.0", "psy/psysh": "@stable" }, "suggest": { "markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.", "dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan/Psalm compatibility.", "phpstan/phpstan": "PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code." }, "autoload": { "psr-4": { "App\": "src/" } }, "autoload-dev": { "psr-4": { "App\Test\": "tests/", "Cake\Test\": "vendor/cakephp/cakephp/tests/" } }, "scripts": { "post-install-cmd": "App\Console\Installer::postInstall", "post-create-project-cmd": "App\Console\Installer::postInstall", "check": [ "@test", "@cs-check" ], "cs-check": "phpcs --colors -p src/ tests/", "cs-fix": "phpcbf --colors -p src/ tests/", "stan": "phpstan analyse src/", "test": "phpunit --colors=always" }, "prefer-stable": true, "config": { "sort-packages": true } }
これも調べましたが、解決策が見つかりませんでした。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。