Can't Setup Laravel Project Using Composer - php

I try to setup a laravel project using composer with this command
composer create-project laravel/laravel blog "5.1.*"
But i got following error:
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Warning: require(/home/iwan/blog/bootstrap/../vendor/aut
oload.php): failed to open stream: No such file or directory in /home/iwan/
blog/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/home/iwan/blog/boots
trap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pea
r') in /home/iwan/blog/bootstrap/autoload.php on line 17
Does anybody know how to fix this ?
Thank you

Actually, the project is created but the dependencies are not installed so open your terminal/command prompt and run following commands:
cd blog
composer install
Also, if you want then, you may install the Laravel installer so you can create a new project using something like the following:
laravel new Blog
This is a little bit faster. So to install the installer you need to run the following command from the command prompt/terminal:
composer global require "laravel/installer=~1.1"
Once you install the installer you may then run laravel new someproject from the terminel to create a new project with all the dependencies (According to Documentation).
Note: Check this and this as well if needed.

Related

Unable to start fresh laravel Project. Artisan exists but cannot run artisan serve

Im trying to start a fresh project and am following this guide:
php version: 8.1.9
Composer version: 1.9.0
I'm able to create a project and have tried a few things like installing, updating, updating -- no script, clearing the dump, but it all turns out to me not being able to run php artisan serve
most errors point to the auto load on the fresh load but whenever i've composer dump-autoload and tried and updated and tried this does not solve anything. I've followed this source and cannot find any answers for my solution
Here are my reproduction steps:
visit the laravel install page.
create basic application using composer create-project laravel/laravel example-app
cd into the app
composer update
composer install
when running php artisan serve
error recieved:
PHP Warning:
require(/someapp/vendor/autoload.php): Failed to open stream: No such file or directory in /someapp/artisan on line 18
after running composer dump-autoload
PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in /Documents/someapp/bootstrap/app.php:14```

PHP Fatal error:Uncaught Error: Failed opening required 'new-project/vendor/autoload.php' (include_path='.;C:\php\pear') in E:\new-project\artisan:18

I want to create new laravel project by composer. I use composer create-project laravel/laravel new-project command for create new project. then, my project is created following this picture.
I start Laravel's local development server using the Laravel's Artisan CLI serve command (first cd new-project and then php artisan serve command). But I got the following error.
Why is there no vendor folder in this project?!!!
How do I fix this error?
(I used PHP 8.1.10)
You need to issue composer install to install packages which creates the vendor/ folder

Why new installed laravel not work on shared hosting?

Now I have installed the Laravel framework using composer command "composer create-project --prefer-dist laravel/laravel myappname" on a local server and everything works fine. Then with the same composer command installed on the shared hosting but nothing works. When I visit to index page return error:
Failed to load resource: the server responded with a status of 500 ()
When I run command php artisan return error on cosole:
PHP Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in /home/c/cn89872/website.com/public_html/bot/ii/bootstrap/app.php:14
How can be solved my problem?
First of all run this command:composer dump-autoload This command will clean up all compiled files and their paths.
After composer update --no-scripts This command will Skips execution of scripts defined in composer.json
Finally, update your project's dependencies: composer update

Laravel does not create folder vendor

After installing Composer it worked well, Laravel created all folders and it started correctly with:
php artisan serve
Now, when I try:
laravel new mypro
It does not create the vendor folder. And when I try:
php artisan serve
It says:
php artisan serve
PHP Warning: require(/mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/autoload.php on line 17
After I copy folder vendor it says:
php artisan serve
PHP Fatal error: Class 'Illuminate\Notifications\NotificationServiceProvider' not found in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog3/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Illuminate\Notifications\NotificationServiceProvider' not found
I encountered the same problem. It occurred because the composer was not able to install the dependencies specified in composer.json file. try running
composer install
If this does not solve the problem, make sure the following PHP modules are installed php-mbstring php-dom
To install this extensions run the following in terminal
sudo apt-get install php-mbstring php-dom
once the installation is complete
try running the command again in your project root folder
composer install
So, if the above doesn't work, you can as well try this command
composer update --no-scripts
More solutions on this thread.
Laravel 5 Failed opening required bootstrap/../vendor/autoload.php
Instead of copying vendor folder please run a command
composer install
in your laravel's project directory
After trying multiple solutions from different sources, the only thing that worked for me was upgrading the PHP version.
Try to install it manually sudo apt-get install php5.6-mbstring

Why I obtain this error message when I try to create a new Laravel projct using Composer?

I am absolutly new in Composer and in Laravel framework.
I am trying to create a new Laravel 5.2 project using Composer to download it performing this statment in the GIT Bash shell:
composer create-project laravel/laravel cms 5.2
But I am obtaining the following error message:
$ composer create-project laravel/laravel cms 5.2
Installing laravel/laravel (v5.2.0)
- Installing laravel/laravel (v5.2.0) Downloading: 100%
Created project in cms
> php -r "copy('.env.example', '.env');"
> php artisan clear-compiled
Warning: require(C:\xampp\htdocs\cms\bootstrap/../vendor/autoload.php): failed t
o open stream: No such file or directory in C:\xampp\htdocs\cms\bootstrap\autolo
ad.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\cms\bootstrap/.
./vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\cms
\bootstrap\autoload.php on line 17
PHP Warning: require(C:\xampp\htdocs\cms\bootstrap/../vendor/autoload.php): fai
led to open stream: No such file or directory in C:\xampp\htdocs\cms\bootstrap\a
utoload.php on line 17
PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\cms\bootst
rap/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdoc
s\cms\bootstrap\autoload.php on line 17
Script php artisan clear-compiled handling the pre-update-cmd event returned wit
h error code 255
Why? What could be the problem? Something related Windows folder permission or what?
How can I try to fix this issue?
It appears composer is trying to flush the compiled files which aren't created yet.
Step 1) Install Laravel without scripts
composer create-project --no-scripts laravel/laravel cms 5.2
Step 2) Run post install scripts manually.
cd cms
composer run-script post-install-cmd
you are having problem because your version value is not complete. you also have to put subversion or asteric(*) symbol
you have to use following command for achieve what you want
composer create-project laravel/laravel cms 5.2.*

Categories