【ERROR】vue-cli 报错 http://eslint.org/docs/....

本文介绍了解决Vue项目中因使用ESLint导致的代码规范报错问题,特别是当第三方库如amazeUI不遵循ESLint规范时的解决办法。通过在Webpack配置文件中排除node_modules目录,可以有效避免此类报错。

使用vue-cl脚手架搭建之后运行报错

........
./src/components/Member/member.vue
]50;CurrentDir=H:\Users\Administrator\Desktop\MyProduct\vue_t
  ✘  http://eslint.org/docs/rules/indent                       Expected indentation of 0 spaces but found 2               
  src\components\Member\member.vue:8:1
    export default {
   ^

  ✘  http://eslint.org/docs/rules/indent                       Expected indentation of 2 spaces but found 4               
  src\components\Member\member.vue:9:1
      data() {
   ^

  ✘  http://eslint.org/docs/rules/space-before-function-paren  Missing space before function parentheses                  
  src\components\Member\member.vue:9:9
      data() {
           ^

  ✘  http://eslint.org/docs/rules/indent                       Expected indentation of 4 spaces but found 6               
  src\components\Member\member.vue:10:1
        return {
   ^
   .............

出现这种错误的原因是,使用了eslint,这个是eslint的规范报错,能不用分号就不用分号。
然后这里报错的原因是因为amazeUI那个库不符合eslint的规范
这里写图片描述

解决这种为题的办法很简单 在webpack配置文件中exclude加入node_modules
这里写图片描述

,{
    test: /\.js$/,
    loader: 'babel!eslint',
    // make sure to exclude 3rd party code in node_modules
    exclude: /node_modules/
  }
PS C:\Users\18712> yarn global add @vue/cli yarn global v1.22.22 [1/4] Resolving packages... warning @vue/cli > vue@2.7.16: Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details. warning @vue/cli > download-git-repo > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported warning @vue/cli > @vue/cli-ui > apollo-server-express@3.13.0: The `apollo-server-express` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > subscriptions-transport-ws@0.11.0: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md warning @vue/cli > download-git-repo > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core@3.13.0: The `apollo-server-core` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-types@3.8.0: The `apollo-server-types` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core > apollo-server-types@3.8.0: The `apollo-server-types` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > vue-codemod > jscodeshift > temp > rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported warning @vue/cli > vue-codemod > jscodeshift > temp > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported warning @vue/cli > vue-codemod > jscodeshift > @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead. warning @vue/cli > vue-codemod > jscodeshift > @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead. warning @vue/cli > vue-codemod > jscodeshift > @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead. warning @vue/cli > download-git-repo > rimraf > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core > apollo-datasource@3.3.2: The `apollo-datasource` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core > apollo-server-env@4.2.1: The `apollo-server-env` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/utils.fetcher` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-types > apollo-server-env@4.2.1: The `apollo-server-env` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/utils.fetcher` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core > apollo-datasource > apollo-server-env@4.2.1: The `apollo-server-env` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/utils.fetcher` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core > apollo-server-errors@3.3.1: The `apollo-server-errors` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core > apollo-reporting-protobuf@3.4.0: The `apollo-reporting-protobuf` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/usage-reporting-protobuf` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-types > apollo-reporting-protobuf@3.4.0: The `apollo-reporting-protobuf` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/usage-reporting-protobuf` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core > apollo-server-plugin-base@3.7.2: The `apollo-server-plugin-base` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > @vue/cli-ui > apollo-server-express > apollo-server-core > apollo-server-plugin-base > apollo-server-types@3.8.0: The `apollo-server-types` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details. warning @vue/cli > vue-codemod > jscodeshift > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated warning @vue/cli > vue-codemod > jscodeshift > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated warning @vue/cli > vue-codemod > jscodeshift > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated warning @vue/cli > vue-codemod > jscodeshift > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages...error C:\Users\18712\AppData\Local\Yarn\Data\global\node_modules\@apollo\usage-reporting-protobuf\node_modules\@apollo\protobufjs: Command failed. Exit code: 1 Command: node scripts/postinstall Arguments: Directory: C:\Users\18712\AppData\Local\Yarn\Data\global\node_modules\@apollo\usage-reporting-protobuf\node_modules\@apollo\protobufjs Output: ϵͳ�Ҳ���ָ����·����
07-09
root@1fe150e26018:/home/project/rzqsoi/sc-dmpx-award-pcmgr-web# yarn build-prod yarn run v1.22.5 $ vue-cli-service build --mode prod ⠙ Building for prod... ERROR Failed to compile with 3 errors 6:21:26 AM error in ./src/assets/element-variables.scss Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93) For more information on which environments are supported please see: https://github.com/sass/node-sass/releases/tag/v4.14.1 @ ./src/main.js 13:0-41 @ multi ./src/main.js error in ./src/App.vue?vue&type=style&index=0&id=86425cc4&prod&lang=scss Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93) For more information on which environments are supported please see: https://github.com/sass/node-sass/releases/tag/v4.14.1 @ ./src/App.vue?vue&type=style&index=0&id=86425cc4&prod&lang=scss 1:0-556 1:0-556 @ ./src/App.vue @ ./src/main.js @ multi ./src/main.js error in ./src/views/techDescDocs/assets/docs/encryption/linkParams.md Syntax Error: ReferenceError: ReadableStream is not defined @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/views/techDescDocs/index.vue?vue&type=script&lang=js 8:0-64 13:4-14 @ ./src/views/techDescDocs/index.vue?vue&type=script&lang=js @ ./src/views/techDescDocs/index.vue @ ./src/router/index.js @ ./src/main.js @ multi ./src/main.js ERROR Build failed with errors. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 帮我分析并解决以上问题
最新发布
09-30
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值