Failed to open stream

What does “I uninstalled composer” mean? You know that composer is required, and you have to run composer install to install all the required dependencies?

The error failed to open stream is related to the vendor/autoload.php file. It means that your composer modules are not installed / something went wrong with composer installing those modules.

But you should always be able to re-install all composer modules via the following commands:

rm -rf vendor composer.lock
composer install

But make sure you are on the latest composer version via

composer self-update

currently it is 2.2.7

i uninstalled composer
i cleaned the AppData\Composer files to avoid installing package from cache, it was about 1 GB of files
and re-install it again with latest version,
Then i ran the command again
composer create-project --prefer-dist cakephp/app myapp
the command complete with the following message in console :

Install of cakephp/plugin-installer failed
[Symfony\Component\Console\Exception\RuntimeException]
Aborted

and i still get the same error in the image in the previous comment

i haven’t neither a composer.json nor composer.lock files now

for this part :

> rm -rf vendor composer.lock
I don’t know where to write this command , i use Windows 10 with WAMP Server

Thanks for your help, i really appreciate it

I don’t really have much windows experience but what I can say about errors with the plugin-installer plugin is the fact, that since Composer 2 you have do confirm the usage of this plugin.

It looks like this https://i.pfiff.me/conhost_gRhpKAckzU.png

You have to confirm this with y and basically every other question which you can confirm with y

By rm -rf vendor composer.lock I mean CLI commands which can be used in Linux and MacOS based systems to remove the vendor folder and composer.lock file.


actually i haven’t the ability to answer with (y). In a previous trial i added the plugin installer to the allowed option in the composer.json to allow it in the installation but the same problem raised.

well this could have multiple reasons. One quick one I would come up with is probably the fact, that the CLI you are using doesn’t have permissions to write the composer.json inside your directory.

How to fix this in Windows? I have no idea. Maybe use an administrator shell?

Also did you confirm, that you are running the latest composer version via composer --version ?

Or try the command composer diagnose to see if composer itself can give you some hints on what can be wrong

Kevin Pfeifer@DESKTOP-PIK660Q C:\Users\Kevin Pfeifer\Desktop\test
# php composer.phar 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: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.2.7
PHP version: 8.1.2
PHP binary path: C:\xampp\php\php.exe
OpenSSL version: OpenSSL 1.1.1m  14 Dec 2021
cURL version: 7.77.0 libz 1.2.11 ssl OpenSSL/1.1.1m
zip: extension present, unzip not available, 7-Zip not available

The only thing that seems strange to me is the fact, that you don’t get to choose.

Have you tried using another shell instead of the ancient Windows CMD? How about Powershell or even better the GIT CLI which gets installed if you install GIT on you machine.

My shell from above comes from XAMPP which seems to be a builtin custom shell :person_shrugging:

Well i used the windows command with the same way for creating multiple cakephp v3 projects and it works fine.
This is my first cakephp v4 project.
I use the command line as administrator but the same.
i wrote previously in the config part of composer.json to allow the plugin to come over question of installing it or no in the console but it also failed
I will search for that again and inform you what i did.
Thanks for your time and helping

After hours of trying , cmd , windows powershell i still get the message of failure to install the plugin-installer

Then i used oven and it installed a v4.0.10 project that is working at last


Finally :

  1. i used oven to install new app with version 4.0.10 ( i don’t know why the latest version isn’t available via oven even I checked internal code the packages[] contains 4.3 ver)

  2. after that i want to install the authentication plugin so i used the following command and i applied the same concept to upgrade the project. Here is the command:

composer require "cakephp/authentication:^2.0" "cakephp/cakephp:^4.3.0" -W

and that finally upgrades the project

thanks @KevinPfeifer for your helping and give me hint about using something else rather than composer. This is my first Oven bake :smiley:

“If anyone uses windows 10 and try to create project from composer only please let me know”

I use Windows 10 running XAMPP and a DOS command prompt: -
composer self-update && composer create-project --prefer-dist cakephp/app:4.* PROJECT_NAME
and have no problem with it.

One suggestion further up was to check your directory level security, so try adding the user everyone with full permissions on the directory and sub-directories of where you’re running composer from. I didn’t need to do this in my case, but it may be necessary - especially if your working in a Windows special directory, like Program Files for instance.