Error Composer file put contents composer json failed to open stream Permission denied

0 votes

I'm trying to install Prestissimo , but that leads to an error:

$ composer global require "hirak/prestissimo:^0.3"
Changed current directory to /home/niroj/.composer


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


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...

I'm logged in as user kramer65, so I wouldn't know why it can't write to my home folder. My normal reaction to a permission denied is to use sudo, but composer then always says:

Do not run Composer as root/super user! See https://getcomposer.org/root for details

Any idea how I can solve this?

Aug 10, 2020 in Laravel by kartik
• 37,520 points
50,766 views

2 answers to this question.

0 votes

Hello @kartik,

It can be resolved with the following command:

$ sudo chown -R $USER ~/.composer/

Hope it works!!
Thank You!!

answered Aug 10, 2020 by Niroj
• 82,840 points
0 votes
I used sudo and it managed to install laravel successfully
answered Nov 2, 2020 by anonymous

Related Questions In Laravel

+1 vote
3 answers

Error: Exception file_put_contents failed to open stream: No such file or directory in Laravel?

Hello, You should typically run the php artisan config:cache command ...READ MORE

answered Mar 31, 2020 in Laravel by Niroj
• 82,840 points
48,809 views
0 votes
1 answer

Error:Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory

Hello @kartik, The best way to solve this ...READ MORE

answered Aug 10, 2020 in Laravel by Niroj
• 82,840 points
6,489 views
0 votes
1 answer

The stream or file "/var/www/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

Hello @kartik, Make your Dockerfile something as below ...READ MORE

answered Sep 30, 2020 in Laravel by Niroj
• 82,840 points
21,448 views
0 votes
2 answers

Error:Laravel Installation failed, reverting ./composer.json to its original content.?

Hello, You need to install php zip extension. Something ...READ MORE

answered Mar 26, 2020 in Laravel by Niroj
• 82,840 points
88,613 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
22,994 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,982 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,910 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,491 views
+1 vote
1 answer

Error:file_put_contents(meta/services.json): failed to open stream: Permission denied?

Hello @kartik, Below steps helped me fix the ...READ MORE

answered Apr 3, 2020 in Laravel by Niroj
• 82,840 points
8,643 views
0 votes
2 answers

Error:Failed to open stream: Permission denied in Laravel?

I had this problem lately with my ...READ MORE

answered Nov 4, 2020 in Laravel by anonymous
• 140 points
16,881 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP