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 in Laravel by kartik
• 27,140 points
744 views

1 answer 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 by Niroj
• 58,500 points

Related Questions In Laravel

+1 vote
2 answers
0 votes
1 answer
0 votes
1 answer

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 in Laravel by Niroj
• 58,500 points
5,364 views
0 votes
1 answer

Error: reverting ./composer.json to its original content

Hello @kartik, I used to use this: composer require ...READ MORE

answered Sep 11 in Laravel by Niroj
• 58,500 points
37 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 in Laravel by Niroj
• 58,500 points
2,170 views
0 votes
1 answer

What is redirection in Laravel?

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

answered Mar 18 in Laravel by Niroj
• 58,500 points
236 views
0 votes
1 answer

How to install Laravel via composer?

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

answered Mar 23 in Laravel by Niroj
• 58,500 points
189 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 in Laravel by Niroj
• 58,500 points
2,683 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 in Laravel by Niroj
• 58,500 points
2,749 views
0 votes
1 answer

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

Hii @kartik, To solve permissions issue on Laravel, ...READ MORE

answered Apr 3 in Laravel by Niroj
• 58,500 points
2,627 views