CSS 并且 JS 未在 Magento 中加载
CSS and JS not loading in Magento
您好,我已经安装了最新版本的 Magento,但它没有加载任何 CSS 或 JS 文件。
我已将其安装在 WAMP 本地,但未收到任何错误。 JS 控制台显示:
GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/extjs/resources/css/ext-all.css net::ERR_ABORTED
(index):23 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/mage/requirejs/mixins.js net::ERR_ABORTED
(index):17 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/extjs/resources/css/ytheme-magento.css net::ERR_ABORTED
(index):19 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/css/styles.css net::ERR_ABORTED
(index):18 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/jquery/jstree/themes/default/style.css net::ERR_ABORTED
(index):22 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/requirejs/require.js net::ERR_ABORTED
(index):126 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/images/magento-logo.svg 404 (Not Found)
(index):23 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/mage/requirejs/mixins.js 404 (Not Found)
requirejs-config.js:16 Uncaught TypeError: require.config is not a function
at requirejs-config.js:16
at requirejs-config.js:17
at requirejs-config.js:440
(anonymous) @ requirejs-config.js:16
(anonymous) @ requirejs-config.js:17
(anonymous) @ requirejs-config.js:440
(index):28 Uncaught TypeError: require.config is not a function
at (index):28
(anonymous) @ (index):28
(index):77 Uncaught TypeError: require is not a function
at (index):77
在对同一问题进行了一些研究后,前往 \magento\pub\static\adminhtml\Magento\backend\en_GB 并删除了 requiresjs-config,但没有结果,似乎是将版本号放入请求中,这可能是问题所在吗?
按照以下步骤-:
在 Magento 网站根目录中-
步骤 1. $ php bin/magento setup:static-content:deploy
步骤 2. $ php bin/magento indexer:reindex
步骤 3. 确保 apache“rewrite_module” 已启用,然后重新启动服务器
步骤 4. $ chown -R www-data:www-data /var/www/html/magento2
步骤 5.
$ chmod -R 775 /var/www/html/magento2/
$ chmod -R 777 /var/www/html/magento2/var/
$ chmod -R 777 /var/www/html/magento2/pub/
步骤 6. 删除 var/cache
下的缓存文件夹
以上步骤有效。我希望这对你也有用。
您好,我已经安装了最新版本的 Magento,但它没有加载任何 CSS 或 JS 文件。
我已将其安装在 WAMP 本地,但未收到任何错误。 JS 控制台显示:
GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/extjs/resources/css/ext-all.css net::ERR_ABORTED
(index):23 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/mage/requirejs/mixins.js net::ERR_ABORTED
(index):17 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/extjs/resources/css/ytheme-magento.css net::ERR_ABORTED
(index):19 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/css/styles.css net::ERR_ABORTED
(index):18 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/jquery/jstree/themes/default/style.css net::ERR_ABORTED
(index):22 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/requirejs/require.js net::ERR_ABORTED
(index):126 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/images/magento-logo.svg 404 (Not Found)
(index):23 GET http://127.0.0.1/magento/pub/static/version1514906660/adminhtml/Magento/backend/en_GB/mage/requirejs/mixins.js 404 (Not Found)
requirejs-config.js:16 Uncaught TypeError: require.config is not a function
at requirejs-config.js:16
at requirejs-config.js:17
at requirejs-config.js:440
(anonymous) @ requirejs-config.js:16
(anonymous) @ requirejs-config.js:17
(anonymous) @ requirejs-config.js:440
(index):28 Uncaught TypeError: require.config is not a function
at (index):28
(anonymous) @ (index):28
(index):77 Uncaught TypeError: require is not a function
at (index):77
在对同一问题进行了一些研究后,前往 \magento\pub\static\adminhtml\Magento\backend\en_GB 并删除了 requiresjs-config,但没有结果,似乎是将版本号放入请求中,这可能是问题所在吗?
按照以下步骤-:
在 Magento 网站根目录中-
步骤 1. $ php bin/magento setup:static-content:deploy
步骤 2. $ php bin/magento indexer:reindex
步骤 3. 确保 apache“rewrite_module” 已启用,然后重新启动服务器
步骤 4. $ chown -R www-data:www-data /var/www/html/magento2
步骤 5.
$ chmod -R 775 /var/www/html/magento2/
$ chmod -R 777 /var/www/html/magento2/var/
$ chmod -R 777 /var/www/html/magento2/pub/
步骤 6. 删除 var/cache
下的缓存文件夹以上步骤有效。我希望这对你也有用。