简体   繁体   中英

Installed composer globally in my localhost, now I get "file_put_contents(./composer.json): failed to open stream: Permission denied"?

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?

您需要在运行composer require ...之前运行composer init ,这将在目录中创建 composer.json 文件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM