clean-docker / Magento2

Docker Image to Magento 2 local development in Mac, Linux and Windows
https://hub.docker.com/r/rafaelcgstz/magento2/
MIT License
444 stars 251 forks source link

Error for new Project #34

Closed avremel closed 6 years ago

avremel commented 6 years ago

I have followed instructions for a new Magento 2 project, here is are my errors:

www-data@c3bf91ff81c6:~/html$ install-magento2
Cannot create cache directory /var/www/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.composer/cache/repo/https---repo.magento.com/, or directory is not writable. Proceeding without cache

    Authentication required (repo.magento.com):
      Username: ab8b9e3fb2346f4ec5b3972f302d9572
      Password: 
Do you want to store credentials for repo.magento.com in /var/www/.composer/auth.json ? [Yn] y
Installing magento/project-community-edition (2.2.2)
Cannot create cache directory /var/www/.composer/cache/files/, or directory is not writable. Proceeding without cache

  [InvalidArgumentException]          
  Project directory ./ is not empty.  

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

chmod: cannot access './var': No such file or directory
chmod: cannot access './vendor': No such file or directory
chmod: cannot access './pub/static': No such file or directory
chmod: cannot access './pub/media': No such file or directory
chmod: cannot access './app/etc': No such file or directory
'/var/www/env.sample.php' -> './app/etc/env.php'
cp: cannot create regular file './app/etc/env.php': No such file or directory
cp: cannot create regular file 'var/composer_home/auth.json': No such file or directory
mv: cannot stat 'package.json.sample': No such file or directory
mv: cannot stat 'Gruntfile.js.sample': No such file or directory
npm WARN enoent ENOENT: no such file or directory, open '/var/www/html/package.json'
npm WARN html No description
npm WARN html No repository field.
npm WARN html No README data
npm WARN html No license field.
Could not open input file: ./bin/magento
rafaelstz commented 6 years ago

Seems like your Composer folder is restricted, use these commands out of the Docker container, inside the folder created on your machine.

./stop && ./kill && sudo chmod -R 777 ~/.composer && rm -rf ./src && mkdir ./src && ./start && ./shell

So, you can run again install-magento2.

Please let me know if it's working well!

avremel commented 6 years ago

Interesting... I am having the exact same issue on a different repo https://github.com/markoshust/magento-docker/issues/80

I have tried to change ownership of composer folder, but with no success... See here https://magento.stackexchange.com/questions/209680/file-permissions-magento-2/209689#209689

rafaelstz commented 6 years ago

Try running these commands to remove and recreate the folders.

Out of the container:

sudo rm -rf ./var/composer_home ./composer.lock ./vendor

Inside the container:

mkdir /var/www/html/vendor/
composer install
avremel commented 6 years ago

It worked!

https://magento.stackexchange.com/questions/209680/file-permissions-magento-2/209689?noredirect=1#comment291671_209689