-1

I've installed composer globally. After the download, I've followed the instructions and added:

mv composer.phar /usr/local/bin/composer

So, now, I'm getting in the folder /var/www/html/buscador and tried to install a project. The Github instruction indicates that I should use:

composer require meilisearch/meilisearch-php guzzlehttp/guzzle http-interop/http-factory-guzzle:^1.0

But using it I get:

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

I've looked for an answer to this, so I've tried this: (rosamunda is my user)

sudo chown -R rosamunda ~/.composer/

It ask for my password and then I get:

chown: cannot access '/home/rosamunda/.composer/': No such file or directory

What am I doing wrong?

Rosamunda
  • 14,620
  • 10
  • 40
  • 70

1 Answers1

2

You need to run composer init before running composer require ..., this will create the composer.json file in the directory

pancheke
  • 84
  • 1
  • 1
  • 7