Home > Blockchain >  I cant install phpspreadsheet using composer
I cant install phpspreadsheet using composer

Time:10-06

I am trying to make an import excel data to mysql using php and trying to install composer require phpoffice/phpspreadsheet but the error below always appear.

Installation failed, deleting ./composer.json.

In RequireCommand.php line 217:
                                                                                                                          
  No composer.json present in the current directory (./composer.json), this may be the cause of the following exception.  
                                                                                                                          

In PackageDiscoveryTrait.php line 313:
                                                                                                                              
  Package phpoffice/phpspreadsheet has requirements incompatible with your PHP version, PHP extensions and Composer version:  
    - phpoffice/phpspreadsheet 1.25.2 requires ext-zip * but it is not present.

At First, I thought i was because of my php version. I am running xampp with php 7.3 on my macOs. it didnt work. I try to install it in my windows PC which run php 7.4 and it work just fine.

So I remove my 7.3 version and install the 7.4 version into my mac. and it didnt work either.

CodePudding user response:

There is no compomposer.json in the directory. When starting a new project, you should at first run

composer init

It will do some question to initialize the value in composer.json, which basically are the same you can pass as parameter to the command: https://getcomposer.org/doc/03-cli.md#init

After that you can run composer to install package

CodePudding user response:

avoid using same name in folder and before installation use composer init

  • Related