Tag Archives: sass

Use sass and less in Vue and solve the problem of error reporting (this. Getoptions is not a function)

Use less

Download dependency

npm install -D less less-loader

Add in main.js

import less from 'less';
Vue.use(less);

use

<style lang="less"></style>

Operation error

 

 

Reason: the version of less loader installed is too high

Solution: reinstall the lower version of

npm uninstall less-loader

npm install [email protected]

 

Using sass

Download dependency

npm install -D node-sass sass-loader style-loader

use

<style lang="scss" scoped></style>

Operation error

Cause: sass loader version is too high

Solution: reinstall the lower version of

npm uninstall sass-loader
npm install [email protected]

 

Failed to build gem native extension encountered while installing sass

Error message

When executing the command: sudo gem install sass , the following error message was encountered

Building native extensions. This could take a while...
ERROR:  Error installing sass:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/ffi-1.11.1/ext/ffi_c
/usr/bin/ruby2.5 -r ./siteconf20190522-24821-9c6o4.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.5.0/gems/ffi-1.11.1 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/ffi-1.11.1/gem_make.out

Solution

Read some online solutions, and finally through the installation of complete Ruby solution

The original command used to install ruby is: sudo apt install Ruby

Use the command sudo apt install Ruby full to install ruby, and then use the command sudo gem install sass to successfully install sass

Module build failed: TypeError: this.getResolve is not a function at Object.loader node-sass Install Error

 

Error in installing node SCSS

When building Vue scaffold or in Vue project, you want to use sass function,

npm install node-sass --save-dev 		
npm install sass-loader --save-dev 		
npm install style-loader --save-dev 		

After the installation is complete, an error occurred at runtime

Modele build failed: TypeError: this.getResolve is not a function at Object.loader...

This is because the current version of SASS is too high, and there is an error during the compilation of webpack. At this time, you only need to change to a lower version. Next, I’ll talk about the modification method. It’s very simple, as follows: find the package.json Just replace the version of “sass loader” in the file.

My local is replacing "sass-loader":"^8.0.0", with "sass-loader":"^7.3.1",

At this time to run the project again, it runs successfully.

You can also uninstall the current version first and then install the specified version

Uninstall the current version npm uninstall sass-loader
Install     npm install [email protected] --save-dev