0

So I am new to php/laravel and am trying to set up my environment here with composer on opensuse 15.0.

When I try to run php artisan migrate

I get this error:

PHP Warning: require(/home/mattyo/FirstLaravelProject/matt-project-laravel/vendor/autoload.php): failed to open stream: No such file or directory in /home/mattyo/FirstLaravelProject/matt-project-laravel/artisan on line 18 PHP Fatal error: require(): Failed opening required '/home/mattyo/FirstLaravelProject/matt-project-laravel/vendor/autoload.php' (include_path='.:/usr/share/php7:/usr/share/php7/PEAR') in /home/mattyo/FirstLaravelProject/matt-project-laravel/artisan on line 18 

I get the same error when trying to run php artisan serve.

I have tried to run composer update along with composer install composer update --no-scripts and had no luck.

Any help would be greatly appreciated.

here's my composer.json

 "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^7.2.5|^8.0", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^6.3.1|^7.0.1", "laravel/framework": "^7.29", "laravel/tinker": "^2.5" }, "require-dev": { "facade/ignition": "^2.0", "fakerphp/faker": "^1.9.1", "mockery/mockery": "^1.3.1", "nunomaduro/collision": "^4.3", "phpunit/phpunit": "^8.5.8|^9.3.3" }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "extra": { "laravel": { "dont-discover": [] } }, "autoload": { "psr-4": { "App\\": "app/" }, "classmap": [ "database/seeds", "database/factories" ] }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "minimum-stability": "dev", "prefer-stable": true, "scripts": { "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] } } 

After running composer global require laravel/installer I received the following error message:

Changed current directory to /home/mattyo/.config/composer Using version ^3.0 for laravel/installer ./composer.json has been updated Running composer update laravel/installer Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - laravel/installer[v3.0.0, ..., v3.0.1] require ext-zip * -> it is missing from your system. Install or enable PHP's zip extension. - laravel/installer[v3.1.0, ..., v3.2.0] require php ^7.2.9 -> your php version (7.2.5) does not satisfy that requirement. - Root composer.json requires laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1, v3.1.0, v3.2.0]. To enable extensions, verify that they are enabled in your .ini files: - /etc/php7/cli/php.ini - /etc/php7/conf.d/ctype.ini - /etc/php7/conf.d/dom.ini - /etc/php7/conf.d/iconv.ini - /etc/php7/conf.d/json.ini - /etc/php7/conf.d/mbstring.ini - /etc/php7/conf.d/openssl.ini - /etc/php7/conf.d/pdo.ini - /etc/php7/conf.d/pdo_sqlite.ini - /etc/php7/conf.d/phar.ini - /etc/php7/conf.d/sqlite3.ini - /etc/php7/conf.d/tokenizer.ini - /etc/php7/conf.d/xmlreader.ini - /etc/php7/conf.d/xmlwriter.ini You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode. Installation failed, reverting ./composer.json to its original content. 
9
  • I have php and composer installed and have created the laravel project successfully. I think it should still work with Composer 1.6.5 yet figured would post what I have here so far. Commented Jan 3, 2021 at 19:34
  • "Your requirements could not be resolved to an installable set of packages." is an important hint. Updating Composer should not be needed, but without more details, it's impossible to tell you why resolving the dependencies does not work. Also, please remove irrelevant tags - currently, I see no connection between your error and SQLite or Artisan Commented Jan 4, 2021 at 6:26
  • You could start by adding the full error message to your question, or at least the content of composer.json Commented Jan 5, 2021 at 15:29
  • I actually got the "Your requirements could not be resolved to an installable set of packages" when I tried to run composer update --no-scripts will add that to original message now with full details Commented Jan 5, 2021 at 15:53
  • Which is "the other error"? Commented Jan 5, 2021 at 15:55

1 Answer 1

0

It seems the autoload.php file wasn't created by Composer for some reason. try composer dump-autoload and see if it works by running php artisan in the terminal.

If this issue still exists, remove the ./vendor directory with rm -rf vendor/* and remove composer cache composer clearcache. Then run composer install again

If none of the above solved the problem, Check if the composer.json file contains wrong or missing dependencies.

Sign up to request clarification or add additional context in comments.

14 Comments

Thanks so much for trying to help here.... I tried everything listed above and it seems to be circling back to this one issue with composer. mattyo@linux-tzsv:~/FirstLaravelProject/matt-project-laravel> composer install Loading composer repositories with package information Warning from https://packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2 Updating dependencies (including require-dev) I checked out the composer.json file and it shows ...
Try to reinstall composer itself from here getcomposer.org/doc/00-intro.md#installation-linux-unix-macos
Just reinstalled composer .. same issue.. mattyo@linux-tzsv:~/FirstLaravelProject/matt-project-laravel> php artisan PHP Warning: require(/home/mattyo/FirstLaravelProject/matt-project-laravel/vendor/autoload.php): failed to open stream: No such file or directory in /home/mattyo/FirstLaravelProject/matt-project-laravel/artisan on line 18 hmm
full composer.json file linked above in original question -- edited ****
OK, composer.json looks like mine. Try to reinstall Laravel with Laravel installer. See laravel.com/docs/8.x#the-laravel-installer
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.