<style lang="less"></style>
When using the HBuilderX development tool to develop the uniapp project, if you want to use this kind of code written in it , it means that less
this preprocessor plug-in is used. If we do not install this plug-in, the following error will be reported when running the uniapp project:
Then you will definitely think of installing less
the preprocessor plug-in, but unexpectedly the following error will be reported. This article is to solve the problem of failure to install the less plug-in.
Solution:
Step 1: Find the location of the HBuilderX installation package, and then显示包内容
Step 2: Find compile-less
the path and find that there is no less plug-in. There is only one important package.json
file in the directory, and the equally important node_modules
folder is not found. This is the reason why the installation of the less plug-in fails.
Step 3: Open package.json
the file, which further proves that the dependency to be installed is indeed there less
, and you only need to install it.
- Step 4: Open the built-in terminal and switch to
compile-less
the directory
cd /Applications/HBuilderX.app/Contents/HBuilderX/plugins/compile-less
Step 4: Then execute sudo npm install
or sudo cnpm install
install less
dependencies
Step 5: I successfully saw node_modules
the folder this time, indicating that the dependencies were successfully installed.
Step 5: Recompile, OK.