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.
Related
hello i am new on composer mongodb, now i am installing mongodb on my COMMAND PROMPT
but it gives me error message
composer require mongodb/mongodb
error:
Cannot use mongodb/mongodb's latest version 1.13.1 as it requires ext-mongodb ^1.14.0 which is missing from your platform.
In PackageDiscoveryTrait.php line 313:
Package mongodb/mongodb has requirements incompatible with your PHP version, PHP extensions and Composer version:
- mongodb/mongodb 1.13.1 requires ext-mongodb ^1.14.0 but it is not present.
my php version is PHP 8.1.10
i already tried this but it's not working
composer require mongodb/mongodb --ignore-platform-reqs
composer require jenssegers/mongodb --ignore-platform-reqs
message of this it said NO Publishable resource
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^1.13 for mongodb/mongodb
./composer.json has been updated
Running composer update mongodb/mongodb
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
INFO Discovering packages.
jenssegers/mongodb ................................................................................. DONE
laravel/sail ....................................................................................... DONE
laravel/sanctum .................................................................................... DONE
laravel/tinker ..................................................................................... DONE
nesbot/carbon ...................................................................................... DONE
nunomaduro/collision ............................................................................... DONE
nunomaduro/termwind ................................................................................ DONE
spatie/laravel-ignition ............................................................................ DONE
82 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> #php artisan vendor:publish --tag=laravel-assets --ansi --force
INFO No publishable resources for tag [laravel-assets].
No security vulnerability advisories found
You have to enable mongodb extension in your php.ini file.
Locate the php.ini file, open it and add this line: extension = mongodb.so;
The php.ini file is located where your php is installes. For example on Windows it can be C:/php/php.ini
So I got my computer back from maintenance, and had to format it. Now I'm trying to re-install everything I had but I'm having trouble installing Laravel. I'm running on a Linux Mint 19.3 OS. I already have PHP installed with all laravel dependecies installed. I installed Composer and when I try to run
composer global require "laravel/installer"
I get this:
Changed current directory to /home/gustavo/.config/composer
Using version ^4.0 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Lock file operations: 12 installs, 0 updates, 0 removals
- Locking laravel/installer (v4.0.5)
- Locking psr/container (1.0.0)
- Locking symfony/console (v5.1.8)
- Locking symfony/polyfill-ctype (v1.20.0)
- Locking symfony/polyfill-intl-grapheme (v1.20.0)
- Locking symfony/polyfill-intl-normalizer (v1.20.0)
- Locking symfony/polyfill-mbstring (v1.20.0)
- Locking symfony/polyfill-php73 (v1.20.0)
- Locking symfony/polyfill-php80 (v1.20.0)
- Locking symfony/process (v5.1.8)
- Locking symfony/service-contracts (v2.2.0)
- Locking symfony/string (v5.1.8)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 12 installs, 0 updates, 0 removals
- Installing symfony/polyfill-php80 (v1.20.0): Extracting archive
- Installing symfony/process (v5.1.8): Extracting archive
- Installing symfony/polyfill-mbstring (v1.20.0): Extracting archive
- Installing symfony/polyfill-intl-normalizer (v1.20.0): Extracting archive
- Installing symfony/polyfill-intl-grapheme (v1.20.0): Extracting archive
- Installing symfony/polyfill-ctype (v1.20.0): Extracting archive
- Installing symfony/string (v5.1.8): Extracting archive
- Installing psr/container (1.0.0): Extracting archive
- Installing symfony/service-contracts (v2.2.0): Extracting archive
- Installing symfony/polyfill-php73 (v1.20.0): Extracting archive
- Installing symfony/console (v5.1.8): Extracting archive
- Installing laravel/installer (v4.0.5): Extracting archive
6 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
10 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
I remember that usually the laravel installation end with "Build something amazing!" but I didn't get that phrase this time. And now, if try
Laravel new
It says Command not found. As if Laravel was never installed. What am I doing wrong?
You need to set your path variable. I don't know how to do it in linux since I'm a windows user but, you can easily find it on Laravel's official documentation. If you're still having some trouble setting the $PATH variable you can see this answer or maybe read about it from the scratch here.
You can also create a new project like this without setting a path variable:
// From the official documentation...
composer create-project --prefer-dist laravel/laravel blog
On most linux distros you need to add ~/.composer/vendor/bin to the $PATH environment variable.
If you are using bash, you can add it to ~/.bashrc with this line
export PATH=$PATH:~/.composer/vendor/bin
laravel-version: 7.24.0
os: windows
I run the following command in the command prompt.
composer require laravel/socialite
but it fails and the output is :
D:\...\xxx>composer require laravel/socialite
Using version ^4.4 for laravel/socialite
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing league/oauth1-client (1.7.0): Loading from cache
- Installing laravel/socialite (v4.4.1): Loading from cache
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
In ProviderRepository.php line 208:
Class 'Laravel\Socialite\SocialiteServiceProvider' not found
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Installation failed, reverting ./composer.json to its original content.
I've tried dump-autoload, and clear configs but anything didn't help me.
The error occurs because socialite package wasn't really installed.
I've checked vender/laravel directory, and socialite wasn't installed.
composer tried to download socialite package but failed. But composer ignores the fail of socialite package, so after composer command completed, they can't find Class 'Laravel\Socialite\SocialiteServiceProvider'.
I'm not sure why downloading socialite package, but I think it's mostly network problem(slow speed or blocked ip location, etc).
So I solved by copying socialite package to vendor directory.
ayat#ayat-Win MINGW64 /c/xampp/htdocs/laravel $ composer
create-project --prefer-dist laravel/laravel cms Creating a
"laravel/laravel" project at "./cms" Installing laravel/laravel
(v7.12.0)
Installing laravel/laravel (v7.12.0): Loading from cache Created project in C:\xampp\htdocs\laravel\cms #php -r "file_exists('.env')
|| copy('.env.example', '.env');" Loading composer repositories with
package information Updating dependencies (including require-dev)
Package operations: 99 installs, 0 updates, 0 removals
Installing voku/portable-ascii (1.5.2): Loading from cache
Installing symfony/polyfill-ctype (v1.18.0): Loading from cache - Installing phpoption/phpoption (1.7.5): Downloading (failed)
Downloading (failed)
Downloading (failed) Failed to download phpoption/phpoption from dist: The
"https://api.github.com/repos/schmittjoh/php-option/zipball/994ecccd8f3283ecf5ac33254543eb0ac946d525"
file could not be downloaded: failed to open stream: A connection
attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because
connected host has failed to respond.
Now trying to download from source
I want to use elasticsearch in my laravel 5.7.11 app and making some search I found
plugin laravel-scout-elastic ( https://github.com/ErickTamayo/laravel-scout-elastic )
and I tried firstly elasticsearch/elasticsearch and laravel-scout-elastic plugin after and the last show error:
$ composer require elasticsearch/elasticsearch
Cannot create cache directory /home/serge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/serge/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/serge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Using version ^6.0 for elasticsearch/elasticsearch
./composer.json has been updated
Cannot create cache directory /home/serge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/serge/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/serge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
- Installing react/promise (v2.7.0): Downloading (100%)
- Installing guzzlehttp/streams (3.0.0): Downloading (100%)
- Installing guzzlehttp/ringphp (1.1.1): Downloading (100%)
- Installing elasticsearch/elasticsearch (v6.0.1): Downloading (100%)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover
Discovered Package: aloha/twilio
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: cviebrock/eloquent-sluggable
Discovered Package: davejamesmiller/laravel-breadcrumbs
Discovered Package: fideloper/proxy
Discovered Package: intervention/image
Discovered Package: itsgoingd/clockwork
Discovered Package: jrean/laravel-user-verification
Discovered Package: laravel/tinker
Discovered Package: laravelcollective/html
Discovered Package: mews/captcha
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: orangehill/iseed
Discovered Package: proengsoft/laravel-jsvalidation
Discovered Package: rap2hpoutre/laravel-log-viewer
Discovered Package: spatie/laravel-activitylog
Discovered Package: spatie/laravel-tags
Discovered Package: spatie/laravel-translatable
Discovered Package: themsaid/laravel-mail-preview
Discovered Package: unisharp/laravel-filemanager
Discovered Package: xethron/migrations-generator
Discovered Package: yajra/laravel-datatables-oracle
Package manifest generated successfully.
> php artisan vendor:publish --provider="Proengsoft\JsValidation\JsValidationServiceProvider" --tag=public --force
Copied Directory [/vendor/proengsoft/laravel-jsvalidation/public] To [/public/vendor/jsvalidation]
Publishing complete.
serge#serge:/mnt/_work_sdb8/wwwroot/lar/Votes$ composer require tamayo/laravel-scout-elastic
Cannot create cache directory /home/serge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/serge/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/serge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Using version ^4.0 for tamayo/laravel-scout-elastic
./composer.json has been updated
Cannot create cache directory /home/serge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/serge/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/serge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: elasticsearch/elasticsearch[5.0.x-dev, v6.0.1].
- Can only install one of: elasticsearch/elasticsearch[v6.0.1, 5.0.x-dev].
- Can only install one of: elasticsearch/elasticsearch[5.0.x-dev, v6.0.1].
- tamayo/laravel-scout-elastic 4.0.0 requires elasticsearch/elasticsearch ^5.0 -> satisfiable by elasticsearch/elasticsearch[5.0.x-dev].
- Installation request for tamayo/laravel-scout-elastic ^4.0 -> satisfiable by tamayo/laravel-scout-elastic[4.0.0].
- Installation request for elasticsearch/elasticsearch (locked at v6.0.1, required as ^6.0) -> satisfiable by elasticsearch/elasticsearch[v6.0.1].
Can you advice me which versions have I to install and how ? I mean if I have to set version of packeges in console command?
Please, show format of these commands...
# php -v
PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Thanks!
You must first install Scout via the following command:
composer require laravel/scout "5.0.x-dev"