1

I am running Magento 2.1 in developer mode. I manually deleted everything in the pub/static/ folder, and then ran the deploy command.

I then cleared cache, I am now getting this error I can't solve? Any advice?

1 exception(s): Exception #0 (Magento\Framework\Exception\FileSystemException): The path "_requirejs/frontend/AZ/az/en_US/requirejs-config.js:
///home/xxx/public_html/xxx/pub/static/home/xxx/public_html/xx/pub/static/" is not writable
  • I have also tried running rm -rf var/cache/* but that is not working to solve the problem. – styzzz Jul 23 '17 at 1:05
  • Let me know if you have any issue. – Prince Patel Jul 23 '17 at 4:48
6

First of all, give permission of pub and var folder

Make sure you must have .htaccess file in pub/static folder. Don't remove .htaccess file from pub/static and pub folder.

If you accidentally remove .htaccess from pub and pub/static copy it from fresh magento setup.

And run php bin/magento setup:static-content:deploy

Don't run each command every time when you made little changes, Hear is my answer about which changes need which commands in magento2: https://magento.stackexchange.com/a/184927/35758

  • this solution worked for me. – jack Nov 25 '17 at 7:12
2

You should press command

sudo chmod -R 777 var/ pub/
1

It is because of the permission mode. Try this command in the root folder of your app:

sudo chmod -R 777 var/ pub/

If the command above don't work.Try the following command:

sudo chown wwwuser -R var/ pub/

  • tried that a while ago. it didnt work. – styzzz Jul 23 '17 at 2:56
  • Try this command : sudo chown wwwuser -R var/ pub/ – Toan Tam Jul 23 '17 at 3:14
  • This solution ended up working. Fixed the backend. For security, should I change the folders back to 755? instead of leaving them at 777? – styzzz Jul 23 '17 at 13:27
  • Yeah, For more security, you should set 755 permission in this case. – Toan Tam Jul 23 '17 at 14:48
  • Why did you unaccept my answer. I thought i worked for you ? – Toan Tam Jul 27 '17 at 2:11
1

I solved the problem by running:

php bin/magento setup:upgrade

then,

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy

and finally,

rm -rf var/cache/*

note: that fixed the frontend. But for some reason now, trying to access the backend is giving me the same error. Even though the front end is totally fine.

  • Don't run each command when you made little changes. Prefer this answer for more information. and let me know if you have any issue magento.stackexchange.com/a/184927/35758 – Prince Patel Jul 23 '17 at 11:15
  • Yeah I know. I wish I never deleted pub/static/* .....the htaccess file is in there, but I still cant access the admin due to the error above. The frontend is working fine. – styzzz Jul 23 '17 at 13:22
1

The problem is that when you delete the whole content of pub/static, you also delete the .htaccess file and this causes your problems with generating symlinks to static resource in developer mode.

So,

  1. Don't delete .htacess file.
  2. Delete only the directory of your specific theme, ex. delete contents only in pub/static/frontend/Your/theme

From my experience, when using symlinks to static files in Developer mode, you don't need to delete them in order to see your changes.

Along with var/cache, you also need to delete files in var/view_preprocessed

I had an issue once with blank screens on both frontend and backend, restarting Apache fixed the issue.

sudo systemctl restart apache2 

service httpd restart
  • restoring .htaccess fixed it – Ahmad Alfy Dec 15 '17 at 14:20
0

it could be a problem with the language. You can try to list languages used in back office after the command php bin/magento setup:static-content:deploy

For example :

php bin/magento setup:static-content:deploy en_US fr_FR

If no language is done after static deploy, only default language is deployed

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.