I'm new to Magento 2 so I still don't have the best experience to debug it.

I recently encountered this issue :

The path "_requirejs/frontend/Magento/luma/en_US:///var/www/html/magento/pub/static/var/www/html/magento/pub/static/" is not writable

This directly triggers on the home page. I have no idea how to fix it.

Any suggestion would be greatly appreciated as I'm still trying to figure out how this new CMS is working.

  • Did you get this error message after running setup:upgrade? Which web server are you using Apache2 or ngnix? – Sourabh Kumar Sharma Sep 27 '18 at 6:49

The solution was only related to permissions issues.

I recommend to anyone facing these kind of issues to run these commands :

cd <your Magento install dir>
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
chown -R :<web server group> .
chmod u+x bin/magento

source: devdocs.magento.com

  • does anyone know if this is a good answer? Im scared to try it ! – styzzz Jul 14 '17 at 4:55
  • @styzzz it works. I have a variation of this which I'll post as an answer. – Mingle Li Jul 19 '18 at 18:47

As per your error message what i can understand is that you pub folder is not having enough permission so that Magento 2 can write into it. Running the below command can help you.

chmod -R 777 pub

Note: Note change 777 to whatever security setup you have on your server. 777 will give full read and write permission to the pub folder.


I agree that it's permission issues. I have used these commands without any problems:

cd <Magento root dir>
chown -R :<group> .
find . -type d -exec chmod 770 {} \;
find . -type f -exec chmod 660 {} \;
chmod +x bin/magento

It's basically the same as WecK0's answer.

For easy use, I made a function and put it in ~/.bashrc:

function fixperm() {
# used for local server
if [ "$PWD" = "<Magento root dir>" ]; then
    echo "### CHOWN-ing all to :<group>"
    chown -R :<group> .
    echo "### CHMOD-ing all directories to 770"
    find . -type d -exec chmod 770 {} \;
    echo "### CHMOD-ing all files to 660"
    find . -type f -exec chmod 660 {} \;
    echo "### CHMOD-ing bin/magento to executable"
    chmod +x bin/magento
    exit 1
    echo "You can only run this command in webroot!"
    exit 1

which can be run in terminal by typing fixperm.


Running this chain of commands on SSL fixed this problem:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento cache:flush
chmod -R 777 pub var app/etc

For development purpose, one should do following things to debug error fastly.

  • Set developer mode and remove # from .htaccess in root directory from line no 5.

    SetEnv MAGE_MODE developer

  • To display errors . Paste followoing lines in index.php

    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);

  • And apply file permissions suggested by Weck0 as per devdocs.

    cd your_Magento_install_dir
    find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
    find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
    chown -R : .
    chmod u+x bin/magento

In magento 2.3 I have tried this code to pass the readiness check first I have gone to root directory with root user

sudo chmod -R 777 pub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.