-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Magento2 cannot resolve path to pub/static JS files #7869
Comments
I noticed the same issue. After installing a blank Magento 2.1.3 you are not able to use the backend because of the missing files. |
I have the same issue after upgrading from Magento 2.1.2 (Enterprise) to Magento 2.1.3 using a composer upgrade. I think it's due to changes made in static files - see release notes:
I am using example nginx configuration, and have tried switching to both developer and production modes. Request reaches static.php correctly which then returns a 404 header to nginx. The referenced files exist on disk and I have verified file permissions. I used the following workaround to disable static file signing, which has corrected the 404 for me: INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`) VALUES ('default', 0, 'dev/static/sign', '0'); You will need to clear cache after this, and also check for any entries with the same config path if you have previously modified this setting. This isn't a very good workaround as it would break cache-busting when using Varnish or any CDNs etc, but at least assets do not 404. |
I ran into the same issue with the upgrade, and the solution is updating the nginx or apache configuration to fix the rewriting issues. The
|
Thanks @jmonschke - my nginx file was missing the fix added in #2323. Adding this works for me. It seems that the other version regexes are redundant (or were broken prior to #2323). I think these should just be removed (see #7921). |
@zucler @careysizer @swieczorek @jmonschke Guys, can you provide us with more information about your configuration to reproduce this issue.
Firstly, I installed Magento CE 2.1.3 via composer on docker contains: 1 with nginx & php, 1 with mysql in default and developer mode and it works.
Is this it? |
@adifucan That is not the issues that I was seeing at all. The issue was that the files were there and being generated, but when the browser made the request for them, the web server was unable to do anything about it. There are new nginx.conf.sample and .htaccess.sample files in the repository that you should pay attention to when running this particular upgrade. |
@jmonschke Sorry for inconvenience but can you provide us with exact steps to reproduce this bug?
|
@adifucan I saw this when upgrading from 2.1.2 to 2.1.3. I am using nginx and docker and EE. I'm in developer mode, and have a special www-data user and group as ownership of the magento files. |
@jmonschke I have just installed Magento EE 2.1.2 on Vagrant with composer and nginx as a web server. I set permissions and ownership like here: http://devdocs.magento.com/guides/v2.1/install-gde/prereq/file-system-perms.html So I guess probably it's the issue with docker? But I have one more question: do you set the Magento root directory to /pub or not? Thanks! |
I have this issue too in developer mode and Magento 2.1.3. For me is related to static files versioning that is defaulted to "on" in Magento 2.1.3. If I change it back to off (from database since admin interface is not working anymore) then it goes well. |
@adifucan to answer you questions: Do you encounter this issue after update from previous version (what version?) to 2.1.3? Do you use Nginx? Do you use docker? What edition of Magento do you use: CE or EE? What permissions and ownership do you have for Magento webroot? What mode are you in? Do you have root $MAGE_ROOT/pub; in nginx.conf.sample file? I haven't tried @jmonschke workaround yet, but I'm definitely running the latest nginx config, so @careysizer case doesn't apply to my setup. Thanks! P.S. I traced my problem to the fact that it gets to static.php script that is then failing to work out a correct path. So, I don't think it is related to permissions. I've also tried changing all files permissions within the container to 777 and it didn't help. Files do exist on the disk though. |
Hi, I have a similar problem but I see the file are in _pub/static/requirejs/adminhtml/Magento/backend/es_CL/ because i change the default language using |
@slimzc - Its all the same problem, regardless of what language you have chosen (from what I understand). |
I encounterd this problem after installing a custum language packege. Additionally the database fix did not work for me. |
Can confirm the same problem. I installed a fresh version 2.1.3 with sample data and run in to the same error with the missed links/files. Can't use the backend. |
I can confirm that adding the rewrite Nginx configuration fixes the issue. Thanks @careys7 and @jmonschke |
Hi @wd7080 |
@zucler, we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue. |
just run a2enmod rewrite (on apache server). It's working for me |
ozziel commented on 7 Oct 2017I must have erased the .htaccess file in /pub/static by accident...I've been looking for the answer for 3 hours! So if you're missing your theme on your admin and your store... check for a versionXXXXXXXXXX in the firebug console. if so recreate the .htaccess file with the above 4 lines in it. Thank you so much! |
Thanks @careys7 : This solution worked. |
Thanks @careys7 : This solution worked for me Also |
Thanks, Worked for me on Magento 2.3.3 and Wamp Server On Wndows |
Thanks, Worked for me on Magento 2.3.3 and Wamp Server On Wndows |
This is still an issue on Magento 2.3.4. This happens with a brand new, fresh M2 install. I'm using:
Permissions all correct, rewrites enabled etc. Disabling static content signing is not a real solution because it will affect caching etc. I can't believe this issue has been closed. @magento-engcom-team Please re-open this issue. |
Agreed, having it on 2.3.4 also... |
He tratado todas las soluciones aportadas por varios sitios sin solución. Finalmente el problema estaba en los archivos de sesión. |
I'm sorry but that's pathetic... M2 v2.3.5 |
Still happening on 2.3.5 with nginx.conf.sample |
Seeing the same on 2.4.0 Open Source/CE - site running fine for weeks following initial installation, no problems till the day I tried static deploy / di compile etc. After first attempt the admin went dead, google TFA disappeared during login, etc. Require.js failing to load at the "version" URL despite Apache setup allowing overrides, no missing htaccess file, permissions set fine, ownership fine, etc etc etc... I also tried changing app/etc/di.xml MaterializationStrategy to "copy" and back to "Symlink" with no difference either way. |
Saem problem version 2.4.0 |
Having the same issue on a fresh Magento 2.4.1 installation. In developer mode I get 403 access denied on some .js and .css files. Interestingly enough those files are just symlinked. When I switch to production mode everything is fine (theres some bugs in the initial files though which wont let you compile - some commas at the wrong places in the code). Anyone ever solved this? |
having same problem after upgrading to magento 2.4.1 |
For some reason, and I don't really know why exactly, but check your apache settings and disable "Restrict the ability to follow symbolic links". I dont know why this suddenly seems to be a problem on Magento 2.4+ (I'm running other Magento 2.3.x installations on the same server without any issues). But disabling this worked out for me. You can also try this, to actually get rid of Magento using symlinks: https://community.magento.com/t5/Can-Magento-do/How-to-use-Magento-2-with-no-symlinks-anywhere/td-p/48402 |
I use nginx ... does someone have a fix for this ? |
I'm not sure about that, I used nginx as a proxy with apache and not pure nginx. I would recommend you to do so aswell. However you might try to make Magento not use symlinks with this:
Found this here: https://community.magento.com/t5/Can-Magento-do/How-to-use-Magento-2-with-no-symlinks-anywhere/td-p/48402 It might help if you have the symlink issue. |
Setting |
…92022 [2.4.6]_Hammer_community_Backlog_06092022
Preconditions
All of the above running in docker containers. Files are sync'ed using docker-sync utility, but I've also tried mounting volumes directly from my local host drive and it did not help.
I've confirmed that PHP is running as www-data user and that all project files have read & write permissions on every file and directory within the project.
I have previously tried deleting all manual content and running
setup:static-content:deploy
. Static files were re-created, but it didn't help me to solve my problem.Lastly, I've troubleshooted the code as far as I could and got to the point where in
vendor/magento/framework/View/Design/FileResolution/Fallback/Resolver/Simple.php file
Error details:
Also, I have confirmed that these files actually exist, but Magento is unable to work out their paths correctly.
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: