M2.x在编译时提示unable to get content for _lib.less

作者:admi... 点击数: 0 收藏到会员中心
最后编辑时间: 2025-04-17 12:31
Compilation from source: /www/wwwroot/app/code/Amasty/Rewards/view/frontend/web/css/source/mkcss/amrewards.less
Unable to get content for 'frontend/Magento/blank/en_US/../../../lib/css/source/lib/_lib.less'

Error happened during deploy process: Magento\Framework\Exception\LocalizedException::__construct():
Argument #1 ($phrase) must be of type Magento\Framework\Phrase, string given, called in 
/www/wwwroot/app/code/Magento/Deploy/Service/DeployPackage.php on line 142


LESS issue on static content deploy. How to resolve it?

The below error when running a bin/magento setup:static-content:deploy command implies that the child theme is not utilizing the Magento LESS to CSS compilation: 


Compilation from source: /srv/public_html/vendor/amasty/module-name/view/base/web/css/source/mkcss/ammodule.less
Unable to get content for 'frontend/Vendor/theme/en_US/../../../lib/css/source/lib/_lib.less'


It can be resolved by following the steps below.


Step 1. In the terminal, open the root Magento directory.


Step 2. Navigate to the directory of the affected module ( vendor/amasty/module-name or app/code/Amasty/ModuleName ) and open the registration.php file. It will contain the module name in the needed format; please copy it for further use.


Step 3. From the module directory, go to the following path: mview/frontend/web/css/source/mkcss and find a file of a similar format:  ammodule.less (e.g. ambrand.less); save its name and copy its content for further use.


Step 4. Navigate to the directory of the theme; it can be found at /app/design/vendor/theme (e.g. app/design/SmartWave/Porto ).


Step 5. There, using the previously copied module and .less file names, create an Amasty_ModuleName/web/css/source/mkcss/ammodule.less file.


Step 6. After that, copy the content of the ammodule.less file from the module folder to the newly created file, and add two "steps" (../../) to the path of _lib.less and  _responsive.less


The file contents should look as follows (the underlined elements in bold are the added ones):

// Generating css file. Path from vendor/magento/theme-frontend-blank
@import (reference) '../../../../../lib::css/source/lib/_lib.less'; // Library files
@import (reference) '../../../../../lib::css/source/lib/_responsive.less'; // Global responsive
@import '../_module.less';


请登录已经激活账号继续浏此文章所有内容!
会员中心

已经有帐号啦 !赶紧同小伙伴们愉快地玩耍吧

立即登录

还没有账号? 马上注册一个新帐户

注册账号
热点标签:
内容说明:
如您需要转载本文请保留以下信息是对作者发文的支持与尊重:

M2.x在编译时提示unable to get content for _lib.less 来源于 https://www.magentola.com/news-read-346.html
上一篇:M2单个域名Apache设置子目录下访问实例
下一篇:奇怪的小知识: M2.4.7 P5版本在后台编辑产品时无法保存
相关内容
产品推荐