Tag Archives: View.js

This dependency was not found:* vue-editor-bridge

Error reporting result:

When the project is running, a compilation error occurs suddenly and the dependency cannot be found. Follow the prompt to execute NPM install — save Vue editor bridge, or an error is reported

This dependency was not found:

* vue-editor-bridge in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Test.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save vue-editor-bridge
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'

Cause finding:

After finding similar error reports, it is found that vscode automatically adds a line of import, as if it entered func when entering function, and vscode imported func as a component by default (you don’t have to be so smart?)

import func from 'vue-temp/vue-editor-bridge'

Solution:

Just delete this line of code

How to Solve VUE Error: Mixed spaces and tabs

Cause of the problem: the project uses eslint specification code, and your code violates the specification

The first scheme (recommended): format the code through the editor and unify the indentation method

The second method: turn off the verification of spaces and tabs by eslin
Vue version 3.0:
1, find build – & gt; webpack.base.config.js。 Comment or remove the reference to eslint loader.

{
      test: /\.(js|vue)$/,
      loader: 'eslint-loader',
      enforce: 'pre',
      include: [resolve('src'), resolve('test')],
      options: {
        formatter: require('eslint-friendly-formatter'),
        emitWarning: !config.dev.showEslintErrorsInOverlay
      }
}

2. Restart the project

Vue 3.0 +:
configure the rules of eslin in package.json. Eslintconfig

 {
      "name": "xxxx",
      "version": "0.1.0",
      "private": true,
      "scripts": {
        "serve": "vue-cli-service serve",
        "build": "vue-cli-service build",
        "lint": "vue-cli-service lint"
      },
      "dependencies": {
        xxx
      },
      "devDependencies": {
       xxx
      },
     
      "eslintConfig": {
        "root": true,
        "env": {
          "node": true
        },
        "extends": [
          "plugin:vue/essential",
          "eslint:recommended"
        ],
        "parserOptions": {
          "parser": "babel-eslint"
        },
        "rules": {
          "no-console": "off",
          "no-debugger": "off",
          "no-mixed-spaces-and-tabs": "off"
        }
     
      },
      "browserslist": [
        "> 1%",
        "last 2 versions",
        "not dead"
      ]
 }

The third other method:
create a vue.config.js

module.exports = {
	lintOnSave:false 
}

How to Solve Vue cli configuration SCSS global variable error

It is configured according to the online tutorial, but it still reports errors. The error information is as follows:

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):

    width: $sideBarWidth !important;
          ^
      Undefined variable: "$sideBarWidth".

Baidu has a problem with the version of SASS loader
// in sass version 9, additionaldata is used, in sass version 8, prependdata is used, and in other versions, data
my version is 7.1.0, so finally changing the key name to data solves the problem

in vue.config.js, the configuration is as follows:

module.exports = {
    ...
	css: {
	  //   extract: true // Whether to use the css separation plugin ExtractTextPlugin (open skeleton screen must be this configuration)
	    // css presetter configuration item
	    // use additionalData in sass version 9 use prependData in version 8, other versions, use data
	    // semicolon here; required
	    loaderOptions: {
	      sass: {
	        data: '@import "./src/styles/variables.scss";'
	      }
	    },
	  },
	 ...
},

Note: semicolon after the configuration file path; Media query expression must begin with ‘(‘

The toast light prompt of vant in Vue reports an error

Toast light prompt for using vant component library in Vue

Record the toast light prompt in vant today, and use it according to the methods in the official documents. It can’t be used if an error is found
this is what the document says

Toast.success('success');
Toast.fail('fail');

After referencing vant in main.js, directly call toast to report an error
the actual usage is as follows:

this.$toast.success("success");
this.$toast.fail("fail");

Like calling routing, you need to click this.

Vue Error: component has been registered but not used [Two Methods to Solve]

reason:

eslint the code checks that you registered the component but did not use it, and then reports an error. For example, code:

For example, the file component is registered in Vue , but it is not actually used:

...
  import File from "../../components/file";
  export default {
    components: {Pagination, File},
...

At this time, you can cancel the registration. Of course, sometimes we don’t want to cancel and don’t change the code. There are two solutions:

Method 1:

Modify the package. JSON
in package.JSON , find rules under eslintconfig , and add "Vue/no unused components": "off" 

Method 2:

If there is a eslintrc.JS file in the project, you can add it as well:

rules: {
  "vue/no-unused-components": "off"
}

Either of the two can be used. Restart the project after modification. Note: if both files are modified, the eslintrc.JS file has higher priority.

Front end initialization Vue element admin error [How to Solve]

Problem Description:
the project is downloaded according to Vue element admin. To initialize the project, run the following code:

npm install

The result reported an error:

after nearly a day of trouble, we finally found a solution:

1. Run the prompt code first:

// input commands
npm fund

Then the following dependent reward donation prompt appears

2. Then enter:

npm run dev

Then it finally succeeded

[Solved] Npm -v Error: Cannot find module npm_cli

1. If you download the upgraded node version from the node official website, the package management NPM will be automatically installed

2. If you install the NVM and then upgrade or downgrade the node version, the NPM is not automatically installed at this time   As shown in the figure, my node 12.10.0 is downloaded from the official website and 10.15.3 is managed by NVM. After switching back, the NPM will not report an error

this.$el.querySelectorAll is not a function [How to Solve]

Problem description
when using El tree, the error this. $el.queryselectorall is not a function is reported, which makes the tree unable to render

Problem resolution
refer to the following code snippet

	<el-tree
        :data="treeData"
        show-checkbox
        node-key="id"
        ref="functionTree"
    ></el-tree>

Most of the errors reported are incorrect data bound by El tree. Data errors can be divided into the following two types:

Case 1:

Cause: wrong format of treeData data.
Solution: check the treeData data format, the data bound by :data must be an array.

Case 2:

Cause: The treeData array contains dirty data such as null
Solution: Delete the null and other dirty data in the data

An error is reported when the less file is introduced into main.js

Today, in a Vue project, I planned to modify the theme of vant, and then an unexpected error occurred. I introduced the less file into main.js, and an error was reported when the project was started.

After looking for the reason, I didn’t find out. Then I tried on the previous old project. From here, I can know that it must be the reason for the version of something. Finally, I found that it is the scaffolding. The new version of Vue cli has helped us configure the less loader and put it in util.js, We just need to modify the webpack.base.conf.js file under the build file, delete or comment out this code, and the project can run normally.

How to Solve “Vue is not defined” Error

Background there is a problem in the introduction of Axios
code

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'


import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './reset.css'

Vue.config.productionTip = false
Vue.use(ElementUI);
axios.default.baseURL = 'https://www.fastmock.site/mock/ad1bc58516abb5f0f452402035be2443/houtai'
Vue.prototype.$http = axios

This is because the order of the two lines of code is wrong
change to

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './reset.css'
axios.default.baseURL = 'https://www.fastmock.site/mock/ad1bc58516abb5f0f452402035be2443/houtai'
Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.use(ElementUI);