Laravel does not create folder vendor - php

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

Related

CodeIgniter -> php spark serve Not Working

I have just created a new project with CodeIgniter.
I tried to run this command to run the server:
php spark serve
But it is giving me this error:
PHP Warning: require(/mnt/e/dev/learning/php/codeigniter/001/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open stream: No such file or directory in /mnt/e/dev/learning/php/codeigniter/001/spark on line 44
PHP Fatal error: require(): Failed opening required '/mnt/e/dev/learning/php/codeigniter/001/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='.:/usr/share/php') in /mnt/e/dev/learning/php/codeigniter/001/spark on line 44
How can I run this command
PHP version 7.2 or newer is required, with the intl extension and mbstring extension installed.
The following PHP extensions should be enabled on your server: php-json, php-mysqlnd, php-xml
And then follow below steps to install and run CI 4 project:
composer create-project codeigniter4/appstarter project-root
composer clearcache
composer update
Config Setting:baseUrl in app/Config/App.php and DB info in app/Config/Database.php
php spark serve
Note: clear composer cache before updating composer. For detail info follow CI documentation
In my case I tried to upgrade my CI setup, and all files I didn't adapt I thought I could easily copy them to retrieve the latest file. Like: cp vendor/codeigniter4/framework/app/Config/Constants.php ./app/Config/
However, I did the same for the app/Config/Paths.php file, but that resulted in your error message as well.
Bottom-line: don't try to replace the Paths.php file from upstream. And the $systemDirectory variable in Paths.php should look like this:
public $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';

Drupal8 installation with Lando

I am having this error when I try to install drupal8 using Lando.
Warning:
require(/app/vendor/composer/../ircmaxell/password-compat/lib/password.php):
failed to open stream: No such file or directory in
/app/vendor/composer/autoload_real.php on line 66 Fatal error:
require(): Failed opening required
'/app/vendor/composer/../ircmaxell/password-compat/lib/password.php'
(include_path='.:/usr/local/lib/php') in
/app/vendor/composer/autoload_real.php on line 66
I have already tried lando composer install and composer update but the error has persisted.
lando restart then do lando composer install
this worked for me.
It seems vendor directly is not available in your repository. Run lando composer install inside web folder then lando drush cr.
Follow the below steps:
Lando start
Lando composer install
install Lando drush cim -y
Lando drush cr

Can't Setup Laravel Project Using Composer

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.

Laravel issue with Patchwork UTF8

I have just pulled a remote Laravel project from Github and ran composer install to create the vendor folder.
However, this returns an error in the terminal:
[RuntimeException]
Could not scan for classes inside "/Applications/MAMP/htdocs/imperialnet/ve
ndor/patchwork/utf8/src/Normalizer.php" which does not appear to be a file
nor a folder
And this error in the error log:
PHP Fatal error: require(): Failed opening required '/Applications/MAMP/htdocs/app/vendor/symfony/var-dumper/Resources/functions/dump.php' (include_path='/Applications/MAMP/htdocs/app/vendor/phpseclib/phpseclib/phpseclib:.:/Applications/MAMP/bin/php/php5.6.2/lib/php') in /Applications/MAMP/htdocs/app/vendor/composer/autoload_real.php on line 58
Looking in Vendor > patchwork > utf8 there is no SRC folder? What is going with composer or ?
I had the same problem. Deleting the vendor folder and the composer.lock file and then running composer install solved the issue.
You may write in console: composer update --dev

"An error occured when executing the cache:clear --no-warmup" while installing symfony-cmf-standard

I was trying to install symfony-cmf-standard using:
composer.phar create-project symfony-cmf/standard-edition symfony-cmf-standard/ --stability=dev
But I am getting the following error:
Could not open input file: app/console
Script sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occured when executing the cache:clear --no-warmup
I am running the command as an Administrator so it should not be a permission issue.
It gives error as when we use the command,
composer.phar create-project symfony-cmf/standard-edition symfony-cmf-standard/ --stability=dev
It creates symfony-cmf-standard folder as a project folder and starts installing dependencies but in between it tries to clear cache using
php app/console cache:clear
But as the current location is outside of the project folder it can not locate app/console so it fails.
Now if we change the directory to inside the project folder and clear cache manually by using command
php app/console cache:clear
It clears cache and then we need to again update dependencies using
php composer.phar update
It worked for me.
I've got an error cut also in the same case: "...PHP Fatal error: Class 'DOMDocument' not found..."
Works after:
install php-xml (can be optionally compiled with this option I suppose)
set date.timezone in /etc/php.ini
On my side with php7.0 I had to install :
php7.0-mbstring
php7.0-xml
Then it worked :)
This happens because of the following bug in DoctrinePHPCRBundle: https://github.com/doctrine/DoctrinePHPCRBundle/issues/17
To fix it, edit the file vendor/doctrine/phpcr-bundle/Doctrine/Bundle/PHPCRBundle/Resources/config/odm.xml inside your symfony-cmf-standard folder and replace this line:
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\ODM\PHPCR\Mapping\Driver\DriverChain</parameter>
With this one:
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain</parameter>
Now copy composer.phar inside your symfony-cmf-standard folder and run with administrator privileges the command:
php composer.phar update
Make sure these are installed:
php-mb or php54w-mbstring or php55w-mbstring
php-xml or php54-xml or php55w-xml
After spending a couple hours on the issue, under FreeBSD you need to install port textproc/php80-xmlreader as well.

Categories