jeudi 26 août 2021

laravel can't start first project [closed]

After downloading the latest php and installing composer. then installed laravel using the command composer global require laravel/installer

    Changed current directory to C:/Users/User/AppData/Roaming/Composer
Using version ^4.2 for laravel/installer
./composer.json has been created
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Lock file operations: 13 installs, 0 updates, 0 removals
  - Locking laravel/installer (v4.2.8)
  - Locking psr/container (1.1.1)
  - Locking symfony/console (v5.3.6)
  - Locking symfony/deprecation-contracts (v2.4.0)
  - Locking symfony/polyfill-ctype (v1.23.0)
  - Locking symfony/polyfill-intl-grapheme (v1.23.1)
  - Locking symfony/polyfill-intl-normalizer (v1.23.0)
  - Locking symfony/polyfill-mbstring (v1.23.1)
  - Locking symfony/polyfill-php73 (v1.23.0)
  - Locking symfony/polyfill-php80 (v1.23.1)
  - Locking symfony/process (v5.3.4)
  - Locking symfony/service-contracts (v2.4.0)
  - Locking symfony/string (v5.3.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 13 installs, 0 updates, 0 removals
    0 [>---------------------------]    0 [>---------------------------]
  - Installing symfony/polyfill-php80 (v1.23.1): Extracting archive
  - Installing symfony/process (v5.3.4): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.23.1): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.23.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.23.1): Extracting archive
  - Installing symfony/polyfill-ctype (v1.23.0): Extracting archive
  - Installing symfony/string (v5.3.3): Extracting archive
  - Installing psr/container (1.1.1): Extracting archive
  - Installing symfony/service-contracts (v2.4.0): Extracting archive
  - Installing symfony/polyfill-php73 (v1.23.0): Extracting archive
  - Installing symfony/deprecation-contracts (v2.4.0): Extracting archive
  - Installing symfony/console (v5.3.6): Extracting archive
  - Installing laravel/installer (v4.2.8): Extracting archive
  0/13 [>---------------------------]   0%
 10/13 [=====================>------]  76%
 12/13 [=========================>--]  92%
 13/13 [============================] 100%
6 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
11 packages you are using are looking for funding.
Use the `composer fund` command to find out more!`

After installation created a project laravel new example-app

 Creating a "laravel/laravel" project at "./example-app"
    Installing laravel/laravel (v8.6.1)
  - Installing laravel/laravel (v8.6.1): Extracting archive
    Created project in C:\test/example-app
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v8.54.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev].
    - league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
    - Root composer.json requires laravel/framework ^8.54 -> satisfiable by laravel/framework[v8.54.0, v8.55.0, v8.56.0, 8.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - C:\php7\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Then I performed cd example-app и php artisan serve. После выполнения php artisan serve gives an error message :

PHP Warning:  require(C:\test\example-app/vendor/autoload.php): Failed to open stream: No such file or directory in C:\test\example-app\artisan on line 18
PHP Fatal error:  Uncaught Error: Failed opening required 'C:\test\example-app/vendor/autoload.php' (include_path='.;C:\php\pear') in C:\test\example-app\artisan:18
Stack trace:
#0 {main}
  thrown in C:\test\example-app\artisan on line 18

After walking through the forums, I realized that there was not enough folder vendor in project Project with files

After adding the vendor folder to the project using the command composer dump-autoload.The folder was added but after running the command composer dump-autoload a new error popped up :

Generating optimized autoload files
Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script
> @php artisan package:discover --ansi
PHP Fatal error:  Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\test\example-app\bootstrap\app.php:14
Stack trace:
#0 C:\test\example-app\artisan(20): require_once()
#1 {main}
  thrown in C:\test\example-app\bootstrap\app.php on line 14
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

Then I tried to execute the command php artisan serve .Throws this error :

PHP Fatal error:  Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\test\example-app\bootstrap\app.php:14
Stack trace:
#0 C:\test\example-app\artisan(20): require_once()
#1 {main}
  thrown in C:\test\example-app\bootstrap\app.php on line 14

Then, walking around the forums, I just did not run to fix this problem I tried: Composer update, Composer install, composer update --no-scripts

composer dump-autoload
composer install --no-scripts

I also tried this :

php artisan clear-compiled
composer dump-autoload

And tried to delete the vendor folder.

And so I tried it, though it says that there is no such file:

composer update --no-scripts
cd bootstrap/cache/->rm -rf *.php
composer dump-autoload

Nothing helped . I do not know what to do. And how to solve this problem.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire