Search code examples
phplaravelswaggercomposer-php

file_put_contents(C:\ProgramData\ComposerSetup\bin): Failed to open stream: Permission denied


I'm trying to install Laravel and tried to compose another like swagger and jwt, the thing is that i can't install it and got a error

file_put_contents(C:\ProgramData\ComposerSetup\bin): Failed to open stream: Permission denied

so each time i tried this

composer require tymon/jwt-auth

composer require darkaonline/l5-swagger

I got an error.

Here is what i install.

Composer version 2.7.7 2024-06-10 22:11:12
PHP version 8.2.12 (C:\xampp\php\php.exe)
Laravel Installer 5.8.2
and I'm using Windows 11


C:\ProgramData\ComposerSetup\bin tried to set all the security in Full Control

I got stuck in here. How to solve this?

Disclaimer: I'm new in laravel.


Solution

  • I answered a somewhat similar problem a few weeks ago, maybe it can help you a bit further, my solution to that problem was to manually change the system variable for composer (in the Environment Variables).

    After the installation of composer, it was automatically set to "C:\Program Data\ComposerSetup\bin".
    I changed this to my installation folder of composer ("C:\xampp\composer\bin").

    (working with the terminal inside VS Code @ win10, laravel11, breeze 2.1.0, php 8.2.12, npm 10.8.1)