Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows10-21H2 composer version can not switch #10444

Closed
miaotiao opened this issue Jan 7, 2022 · 7 comments
Closed

windows10-21H2 composer version can not switch #10444

miaotiao opened this issue Jan 7, 2022 · 7 comments
Labels
Milestone

Comments

@miaotiao
Copy link

miaotiao commented Jan 7, 2022

Output of composer diagnose:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: xxx
Dev Public Key Fingerprint: xxxx
OK
Checking composer version: You are not running the latest stable version, run `composer self-update` to update (1.10.24 => 2.2.3)
Composer version: 1.10.24
PHP version: 8.1.1
PHP binary path: C:\Users\mt\soft\install\php-8.1.1-nts-Win32-vs16-x64\php.exe
OpenSSL version: OpenSSL 1.1.1l  24 Aug 2021

When I run this command:

run composer self-update --2
result:

Updating to version 2.2.3 (2.x channel).
   Downloading (100%)
  [Composer\Downloader\FilesystemException]
  Filesystem exception:
  Composer update failed: "C:\ProgramData\ComposerSetup\bin\composer.phar" could not be written.
  rename(C:\ProgramData\ComposerSetup\bin/composer-temp.phar,C:\ProgramData\ComposerSetup\bin\composer.phar): 拒绝访
  问。 (code: 5)

I get the following output:

Loading config file C:/Users/dev/AppData/Roaming/Composer/config.json
Loading config file C:/Users/dev/AppData/Roaming/Composer/auth.json
Failed to initialize global composer: Composer could not find the config file: C:/Users/dev/AppData/Roaming/Composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 1.10.24 (2021-12-09 20:06:33) with PHP 8.1.1 on Windows NT / 10.0
Loading config file C:/Users/dev/AppData/Roaming/Composer/config.json
Loading config file C:/Users/dev/AppData/Roaming/Composer/auth.json
Failed to initialize global composer: Composer could not find the config file: C:/Users/dev/AppData/Roaming/Composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Checked CA file /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a file.
Checked directory /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a directory.
Checked CA file /etc/ssl/certs/ca-certificates.crt does not exist or it is not a file.
Checked directory /etc/ssl/certs/ca-certificates.crt does not exist or it is not a directory.
Checked CA file /etc/ssl/ca-bundle.pem does not exist or it is not a file.
Checked directory /etc/ssl/ca-bundle.pem does not exist or it is not a directory.
Checked CA file /usr/local/share/certs/ca-root-nss.crt does not exist or it is not a file.
Checked directory /usr/local/share/certs/ca-root-nss.crt does not exist or it is not a directory.
Checked CA file /usr/ssl/certs/ca-bundle.crt does not exist or it is not a file.
Checked directory /usr/ssl/certs/ca-bundle.crt does not exist or it is not a directory.
Checked CA file /opt/local/share/curl/curl-ca-bundle.crt does not exist or it is not a file.
Checked directory /opt/local/share/curl/curl-ca-bundle.crt does not exist or it is not a directory.
Checked CA file /usr/local/share/curl/curl-ca-bundle.crt does not exist or it is not a file.
Checked directory /usr/local/share/curl/curl-ca-bundle.crt does not exist or it is not a directory.
Checked CA file /usr/share/ssl/certs/ca-bundle.crt does not exist or it is not a file.
Checked directory /usr/share/ssl/certs/ca-bundle.crt does not exist or it is not a directory.
Checked CA file /etc/ssl/cert.pem does not exist or it is not a file.
Checked directory /etc/ssl/cert.pem does not exist or it is not a directory.
Checked CA file /usr/local/etc/ssl/cert.pem does not exist or it is not a file.
Checked directory /usr/local/etc/ssl/cert.pem does not exist or it is not a directory.
Checked CA file /usr/local/etc/openssl/cert.pem does not exist or it is not a file.
Checked directory /usr/local/etc/openssl/cert.pem does not exist or it is not a directory.
Checked CA file /usr/local/etc/openssl@1.1/cert.pem does not exist or it is not a file.
Checked directory /usr/local/etc/openssl@1.1/cert.pem does not exist or it is not a directory.
Checked CA file /etc/pki/tls/certs does not exist or it is not a file.
Checked directory /etc/pki/tls/certs does not exist or it is not a directory.
Checked CA file /etc/ssl/certs does not exist or it is not a file.
Checked directory /etc/ssl/certs does not exist or it is not a directory.
Checked CA file /etc/ssl does not exist or it is not a file.
Checked directory /etc/ssl does not exist or it is not a directory.
Checked CA file /usr/local/share/certs does not exist or it is not a file.
Checked directory /usr/local/share/certs does not exist or it is not a directory.
Checked CA file /usr/ssl/certs does not exist or it is not a file.
Checked directory /usr/ssl/certs does not exist or it is not a directory.
Checked CA file /opt/local/share/curl does not exist or it is not a file.
Checked directory /opt/local/share/curl does not exist or it is not a directory.
Checked CA file /usr/local/share/curl does not exist or it is not a file.
Checked directory /usr/local/share/curl does not exist or it is not a directory.
Checked CA file /usr/share/ssl/certs does not exist or it is not a file.
Checked directory /usr/share/ssl/certs does not exist or it is not a directory.
Checked CA file /etc/ssl does not exist or it is not a file.
Checked directory /etc/ssl does not exist or it is not a directory.
Checked CA file /usr/local/etc/ssl does not exist or it is not a file.
Checked directory /usr/local/etc/ssl does not exist or it is not a directory.
Checked CA file /usr/local/etc/openssl does not exist or it is not a file.
Checked directory /usr/local/etc/openssl does not exist or it is not a directory.
Checked CA file /usr/local/etc/openssl@1.1 does not exist or it is not a file.
Checked directory /usr/local/etc/openssl@1.1 does not exist or it is not a directory.
Checked CA file C:\Users\dev\AppData\Local\Temp\opeDDB3.tmp: valid
Downloading https://getcomposer.org/versions
Updating to version 2.2.3 (2.x channel).
Downloading https://getcomposer.org/download/2.2.3/composer.phar.sig
   Downloading https://getcomposer.org/download/2.2.3/composer.phar
Downloading (100%)


  [Composer\Downloader\FilesystemException]
  Filesystem exception:
  Composer update failed: "C:\ProgramData\ComposerSetup\bin\composer.phar" could not be written.
  rename(C:\ProgramData\ComposerSetup\bin/composer-temp.phar,C:\ProgramData\ComposerSetup\bin\composer.phar): 拒绝访
  问。 (code: 5)


Exception trace:
 () at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/SelfUpdateCommand.php:432
 Composer\Command\SelfUpdateCommand->setLocalPhar() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/SelfUpdateCommand.php:301
 Composer\Command\SelfUpdateCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:283
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:113
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:64
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:24

And I expected this to happen:

can switch composer 1.* to composer 2.*

@johnstevenson
Copy link
Member

This is very weird. I can confirm that updating from 1.10.24 to 2.2.3 doesn't work on PHP-8.1, but I have no idea why (PHP-8.0 works fine).

Also, updating and rolling back 2.2 versions in PHP-8.1 is not a problem.

@Seldaek
Copy link
Member

Seldaek commented Jan 8, 2022

Thanks for pinpointing the problem and reporting it upstream @johnstevenson - leaving this open for now until the bug is fixed in PHP. For the time being please try to self-update using a version lower than 8.1 @miaotiao or simply reinstall Composer from scratch so you get the latest.

@johnstevenson
Copy link
Member

@miaotiao You can also rename the file yourself. Since you were running as an Admin, the file was downloaded as C:\ProgramData\ComposerSetup\bin\composer-temp.phar so just rename it manually to composer.phar. (It didn't get deleted as it should have).

@Seldaek Fix on the way for 1.10 versions.

@Seldaek
Copy link
Member

Seldaek commented Jan 8, 2022

Not sure it's worth fixing on our end if a 8.1.x fix is also coming.

@johnstevenson
Copy link
Member

Ah, I've already done it. Anyway, it is up to you (it would at least allow 8.1.0 and 8.1.1 versions to keep working).

@miaotiao
Copy link
Author

miaotiao commented Jan 8, 2022

Thank you so much , happy weekend

@Seldaek Seldaek closed this as completed Jan 21, 2022
@Seldaek Seldaek added this to the 1.10 milestone Jan 21, 2022
@Seldaek Seldaek added Bug and removed Support labels Jan 21, 2022
@Seldaek
Copy link
Member

Seldaek commented Jan 21, 2022

1.10.25 released with the fix, but to self-update to it you'll have to use php<8.1 of course :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants