添加带纱线的模块,减少编译错误

时间:2018-04-19 09:23:23

标签: less phpstorm webstorm yarnpkg

我添加了一个示例模块:

yarn add jquery.fancytree

我在使用Less file watcher的PhpStorm中遇到很多错误:

/usr/local/bin/lessc --no-color bootstrap-datetimepicker-build.less
FileError: 'bootstrap/less/variables.less' wasn't found. Tried - /home/grek/PhpstormProjects/crm4/web/js/eonasdan-bootstrap-datetimepicker/src/less/bootstrap/less/variables.less,/home/grek/PhpstormProjects/crm4/web/js/eonasdan-bootstrap-datetimepicker/src/less/bootstrap/less/variables.less,/home/grek/PhpstormProjects/crm4/web/js/eonasdan-bootstrap-datetimepicker/src/less/node_modules/bootstrap/less/variables.less,bootstrap/less/variables.less in /home/grek/PhpstormProjects/crm4/web/js/eonasdan-bootstrap-datetimepicker/src/less/bootstrap-datetimepicker-build.less on line 2, column 1:
1 // Import bootstrap variables including default color palette and fonts
2 @import "bootstrap/less/variables.less";
3 

这不是第一次,我有时会在不同的模块中收到此错误。

1 个答案:

答案 0 :(得分:2)

不确定此导入的来源;什么是bootstrap - 这是一个npm模块吗?无论如何,您需要让编译器知道您查找文件的位置。要执行此操作,请尝试使用--include-path选项,例如--include-path=$ProjectFileDir$/node_modules(必须添加到文件观察程序参数)。见http://lesscss.org/usage/