Magento开源2.3-CSS和JS无法加载 [英] Magento Open Source 2.3 - CSS and JS not loading

查看:583
本文介绍了Magento开源2.3-CSS和JS无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功安装了Magento 2.3,但是当键入

I installed Magento 2.3 successfully but when type

,这些是在控制台中发现的错误:

and these are the errors found in the console:

管理面板上也面临相同的问题.我当前的PHP版本是7.2.14.

The same issue is also faced on the admin panel. My current version of PHP is 7.2.14.

推荐答案

您不能将http://localhost/用作Magento 2的域名,至少应使用http://localhost.com/.

You cannot use http://localhost/ as domain name with Magento 2, you should at least use http://localhost.com/.

  1. 在Docker/XAMP/MAMP/WAMP中更改您的vHost ...以匹配您的新域名,例如http://localhost.com/;

使用sudo权限编辑主机文件:

Edit your hosts file with sudo permissions :

  • Debian/MacOS:/etc/hosts

Windows:C:\Windows\System32\drivers\etc\hosts

在文件的底部,添加以下内容:127.0.0.1 localhost.com

At the bottom of the file, add the following: 127.0.0.1 localhost.com

转到您的Magento数据库并运行以下查询:

Go to your Magento db and run the following query :

UPDATE `core_config_data` SET `value`='http://localhost.com/' WHERE `value`='http://localhost/';

  1. 最后,使用命令行:

cd /YOUR/PROJECT/PATH
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

  1. 转到http://localhost.com/(或根据您的配置,选择http://localhost.com/Magento2/),然后检查是否一切正常.
  1. Go to http://localhost.com/ (or http://localhost.com/Magento2/, according to your configuration), and check if everything works.

这篇关于Magento开源2.3-CSS和JS无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆