Composer: file_put_contents(./composer.json or ./composer.lock): failed to open stream: Permission denied

LaravelLinux

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

Problem

When I run Composer update in my project then I got this error.

[ErrorException]
  file_put_contents(./composer.lock): failed to open stream: Permission denied

Solution

It can be resolved with the following command:

sudo chown -R $USER ~/.composer/Code language: JavaScript (javascript)

That’s all.

I hope this article helps you to fix your issue.

Thanks for reading.

Keep Exploring.