“The zip extension and unzip/7z commands are both missing, skipping” in Windows during Composer install of Laravel

Posted by

Error:

Failed to download srmklive/paypal from dist: The zip extension and unzip/7z commands are both missing, skipping. The php.ini used by your command-line PHP is: C:\xampp\php\php.ini Now trying to download from source - Syncing srmklive/paypal (3.0.32) into cache - Installing srmklive/paypal (3.0.32): Cloning 031d69d7c9 from cache Install of srmklive/paypal failed In GitDownloader.php line 509: Failed to execute git checkout 031d69d7c99f9ef0874a34cb85326ede28cd7aed -- && git reset --hard 031d69d7c99f9ef0874a34cb85326ede28cd7aed -- error: The following untracked working tree files would be overwritten by checkout: .coveralls.yml .gitattributes .github/workflows/static-analysis.yml .github/workflows/tests.yml .gitignore .scrutinizer.yml .travis.yml.bak

Solution:

1. Solve the “Untracked Files” Issue:

Git is unable to proceed with the checkout because untracked files would be overwritten. Follow these steps:

Option 1: Stash or Commit Your Changes

If you have untracked files or changes that are not yet committed, you should either stash or commit them to avoid losing them.

  • Stash changes:
git stash
  • Commit changes:
git add . 
git commit -m "Your commit message"

Option 2: Clean Untracked Files

If you don’t need the untracked files and want to proceed with a clean workspace, you can remove the untracked files:

  • Preview untracked files that will be removed:
git clean -n
  • Remove the untracked files:
git clean -f

2. Solve the Missing PHP Extensions Issue:

The error indicates that the zip extension and unzip/7z commands are missing. You need to install these on your system.

Install zip extension for PHP:

  1. Open your php.ini file (in your case, located at C:\xampp\php\php.ini).
  2. Find the following line (it may be commented out): iniCopy;extension=zip
;extension=zip
  1. Uncomment the line by removing the semicolon: iniCopyextension=zip
extension=zip
  1. Restart your web server (XAMPP or whichever you’re using).

Install unzip or 7z:

If you don’t have unzip or 7z installed, you can download and install them:

  • Install unzip (Windows):
    • Download and unzip for Windows and install it.
    • Add the path to the unzip executable to your system’s PATH environment variable.
  • Install 7z (Windows):
    • Download and install 7-Zip.
    • Ensure the path to 7z.exe is in your system’s PATH.

Test the installation:

Once you’ve made the necessary changes, test that the PHP extensions are enabled:

php -m | grep zip

This should return zip if the extension is installed correctly. Also, make sure the unzip or 7z commands are available in your command line.

3. Retry Composer Install

After addressing the issues, run the composer install command again:

composer install

Additional Tips:

  • If you continue facing issues with Git after performing the clean and resolving the dependencies, try running:
composer update
  • This can help refresh any missing packages or resolve conflicts.

Leave a Reply

Your email address will not be published. Required fields are marked *

0
Would love your thoughts, please comment.x
()
x