14

newbie here.

I was trying to install MISP in my Ubuntu, following this installation guide:INSTALL.ubuntu1804.txt

When it comes to this instruction:

# Once done, install CakeResque along with its dependencies if you intend to use the built in background jobs:
cd /var/www/MISP/app
sudo -u www-data php composer.phar require kamisama/cake-resque:4.1.2

I got this:

Cannot create cache directory /home/akatiubuntutest/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/akatiubuntutest/.composer/cache/files/, or directory is not writable. Proceeding without cache
./composer.json has been updated
Cannot create cache directory /home/akatiubuntutest/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/akatiubuntutest/.composer/cache/files/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing monolog/monolog (1.23.0)
    Downloading: 65%^C        

I tried the solution here Cannot create cache directory ! help me solve this when create laravel project with composer:

sudo chown -R <user> /home/<user>/.composer/cache/repo/https---packagist.org

But (well, logically, since it is yet to be created) I got this:

chown: cannot access '/home/<user>/.composer/cache/repo/https---packagist.org/': No such file or directory

I've already installed PHP and the dependencies:

# Install PHP and dependencies
sudo apt-get install libapache2-mod-php php php-cli php-gnupg php-dev php-json php-mysql php-opcache php-readline php-redis php-xml php-mbstring

Right now, I'm not sure what I missed doing.

1
  • It might be a permissions error with something earlier in the path (like maybe ~/.composer is owned by root or something). Try running sudo chown -R $USER. ~ to ensure everything in your home directory is owned by you. Commented Sep 24, 2018 at 3:21

2 Answers 2

26

if anyone pass through here, this is shorter solution:

sudo chown -R $USER $HOME/.composer
1
  • That removes the exception but on lightsail whatever i do composer update/install it always kills the command. Commented Nov 14, 2019 at 19:33
10

it seems to me the group information is missing in your command

sudo chown -R <user> /home/<user>/.composer/cache/repo/https---packagist.org

Shoud be

sudo chown -R <user>:<group> /home/<user>/.composer/cache/repo/https---packagist.org

But to avoid other permission issues, I would rather advise:

sudo chown -R <user>:<group> /home/<user>/.composer/cache

(you'll need access to other folders in there) and

sudo chown <user>:<group> /home/<user>/.composer

To make sure your user has permissions enough on the global composer folder. Mind the missing recursion so the user don't own keys created by root. If you need to find out the group:

groups <user>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .