What to do if there is an error when compiling SASS in vue project
Solution to vue project compilation sass error: 1. Use the image source "cnpm install node-sass sass-loader --save-dev" to install sass; 2. Change "sass" in "package.json" -loader" version is ""sass-loader": "^7.3.1","; 3. Use it directly in the page or use @ instead of src.
The operating environment of this tutorial: Windows 10 system, sass-loader version 7.3.1, Dell G3 computer.
What should I do if there is a sass compilation error in the vue project?
Solve the error reporting problem when vue uses Sass
Installation:
npm config set registry https://registry.npm.taobao.org/ //sass-node报错的话,使用镜像源cnpm install node-sass sass-loader --save-dev 再安装一次 npm install node-sass --registry=https://registry.npm.taobao.org
"sass-loader": "^7.3.1",
Use:
Use directly or @ instead of src in the page (@ does not need to be configured in 3.x, but needs to be configured in the webpack file in 2.x)Problem description:
The following problem is an error I encountered when using sass:*!!vue-style-loader!css-loader?{“sourceMap”:true}! ../../../../vue-loader/lib/style-compiler/index?{“vue”:t rue,”id”:”data-v-570115ee”,”scoped”:false,”hasInlineConfig”:false}!../../../../vux-loader/src/after-less-loader.js!less-loader?{“so urceMap”:true}!../../../../vux-loader/src/style-loader.js!../../../../vue-loader/lib/selector?type=style s&index=0!./index.vue in ./node_m odules/vux/src/components/alert /index.vue
Solution Such problems are generally caused by a lack of related dependencies. For this example, carefully read the error message and grasp the keywords, vue-style-loader! css-loader, which means there is a problem when css is parsed.
Therefore, the solution depends on the situation and depends on the CSS language you use, whether it is regular or less or sass.
regular, execute
npm install stylus-loader css-loader style-loader --save-dev
less, execute
npm install less less-loader --save-dev
sass, just execute
npm install sass sass-loader --save-dev
or
$npm intall sass-loader --save ; $npm install node-sass --save
If you don’t know, okay, you three Are you going to execute them all?.
Generally this problem will only occur when initializing the configuration. If the project is already intact, it will have been configured in package.json and can be installed directly.
Recommended learning: "vue video tutorial"
The above is the detailed content of What to do if there is an error when compiling SASS in vue project. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

You can add a function to the Vue button by binding the button in the HTML template to a method. Define the method and write function logic in the Vue instance.

The watch option in Vue.js allows developers to listen for changes in specific data. When the data changes, watch triggers a callback function to perform update views or other tasks. Its configuration options include immediate, which specifies whether to execute a callback immediately, and deep, which specifies whether to recursively listen to changes to objects or arrays.

Vue multi-page development is a way to build applications using the Vue.js framework, where the application is divided into separate pages: Code Maintenance: Splitting the application into multiple pages can make the code easier to manage and maintain. Modularity: Each page can be used as a separate module for easy reuse and replacement. Simple routing: Navigation between pages can be managed through simple routing configuration. SEO Optimization: Each page has its own URL, which helps SEO.

Vue.js has four methods to return to the previous page: $router.go(-1)$router.back() uses <router-link to="/" component window.history.back(), and the method selection depends on the scene.

There are three ways to refer to JS files in Vue.js: directly specify the path using the <script> tag;; dynamic import using the mounted() lifecycle hook; and importing through the Vuex state management library.

There are three common methods for Vue.js to traverse arrays and objects: the v-for directive is used to traverse each element and render templates; the v-bind directive can be used with v-for to dynamically set attribute values for each element; and the .map method can convert array elements into new arrays.

There are two ways to jump div elements in Vue: use Vue Router and add router-link component. Add the @click event listener and call this.$router.push() method to jump.
