Error rule can only have one resource source provided resource and test include exclude in

Maybe related to @nuxtjs/eslint-module Versions nuxt: v2.14.6 node: v15.0.2 --> Reproduction Create a fresh app with following parameters, and try to npm run dev npx create-nuxt-app docs create-...

This issue is certainly not resolved. I get this every time I create a new project:

nuxt.config.js

import colors from 'vuetify/es5/util/colors'

export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    titleTemplate: '%s - records',
    title: 'records',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' },
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/eslint
    '@nuxtjs/eslint-module',
    // https://go.nuxtjs.dev/vuetify
    '@nuxtjs/vuetify',
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    // https://go.nuxtjs.dev/pwa
    '@nuxtjs/pwa',
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {},

  // PWA module configuration: https://go.nuxtjs.dev/pwa
  pwa: {
    manifest: {
      lang: 'en',
    },
  },

  // Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
  vuetify: {
    customVariables: ['~/assets/variables.scss'],
    theme: {
      dark: true,
      themes: {
        dark: {
          primary: colors.blue.darken2,
          accent: colors.grey.darken3,
          secondary: colors.amber.darken3,
          info: colors.teal.lighten1,
          warning: colors.amber.base,
          error: colors.deepOrange.accent4,
          success: colors.green.accent3,
        },
      },
    },
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {},
}

package.json

{
  "name": "records",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "lint:js": "eslint --ext ".js,.vue" --ignore-path .gitignore .",
    "lint": "npm run lint:js",
    "test": "jest"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.12.5",
    "@nuxtjs/pwa": "^3.3.4",
    "core-js": "^3.8.2",
    "nuxt": "^2.14.12"
  },
  "devDependencies": {
    "@nuxtjs/eslint-config": "^5.0.0",
    "@nuxtjs/eslint-module": "^3.0.2",
    "@nuxtjs/vuetify": "^1.11.3",
    "@vue/test-utils": "^1.1.2",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.18.0",
    "eslint-config-prettier": "^7.1.0",
    "eslint-plugin-nuxt": "^2.0.0",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-vue": "^7.4.1",
    "jest": "^26.6.3",
    "prettier": "^2.2.1",
    "vue-jest": "^3.0.4"
  }
}

Error: Rule can only have one resource source
(provided resource and test + include + exclude)

<> problem :Error: Rule can only have one resource source (provided resource and
test + include + exclude)
Error: Rule can only have one resource source (provided resource and test +
include + exclude) in «exclude»: [ null ], «use»: [ { «loader»:
«/Users/juanpablo/front-treatments/node_modules/cache-loader/dist/cjs.js»,
«options»: { «cacheDirectory»:
«/Users/juanpablo/front-treatments/node_modules/.cache/babel-loader»,
«cacheIdentifier»: «81fef5a6» }, «ident»: «clonedRuleSet-38[0].rules[0].use[0]»
}, { «loader»:
«/Users/juanpablo/front-treatments/node_modules/babel-loader/lib/index.js»,
«options»: «undefined», «ident»: «undefined» } ] } «« A complete log of this
run can be found in: 0 info it workedif it ends with ok 1 verbose cli [ 1
verbose cli’/Users/juanpablo/.nvm/versions/node/v12.19.0/bin/node’, 1 verbose
cli’/Users/juanpablo/.nvm/versions/node/v12.19.0/bin/npm’, 1 verbose cli ‘run’,
1 verbose cli’serve’ 1 verbose cli ] 2 info using npm@6.14.8 3 info using
node@v12.19.0 4 verbose run-script[ ‘preserve’, ‘serve’, ‘postserve’ ] 5 info
lifecycle vue-dashboard@0.1.0~preserve: vue-dashboard@0.1.0 6 info lifecycle
vue-dashboard@0.1.0~serve: vue-dashboard@0.1.0 7 verbose lifecycle
vue-dashboard@0.1.0~serve: unsafe-permin lifecycle true 8 verbose lifecycle
vue-dashboard@0.1.0~serve: PATH:
/Users/juanpablo/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/juanpablo/front-treatments/node_modules/.bin:/Users/juanpablo/.nvm/versions/node/v12.19.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/juanpablo/.rvm/bin
9 verbose lifecycle vue-dashboard@0.1.0~serve: CWD:
/Users/juanpablo/front-treatments 10 silly lifecycle vue-dashboard@0.1.0~serve:
Args:[ ‘-c’, ‘vue-cli-service serve’ ] 11 silly lifecycle
vue-dashboard@0.1.0~serve: Returned: code: 1 signal: null 12 info lifecycle
vue-dashboard@0.1.0~serve: Failed toexec serve script 13 verbose stack Error:
vue-dashboard@0.1.0 serve:`vue-cli-service serve` 13 verbose stack Exit status
1 13 verbose stack at EventEmitter.<anonymous> (
/Users/juanpablo/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16
) 13 verbose stack at EventEmitter.emit (events.js:314:20) 13 verbose stack at
ChildProcess.<anonymous> (
/Users/juanpablo/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14
) 13 verbose stack at ChildProcess.emit (events.js:314:20) 13 verbose stack at
maybeClose(internal/child_process.js:1021:16) 13 verbose stack at
Process.ChildProcess._handle.onexit(internal/child_process.js:286:5) 14 verbose
pkgid vue-dashboard@0.1.0 15 verbose cwd /Users/juanpablo/front-treatments 16
verbose Darwin 19.6.0 17 verbose argv
«/Users/juanpablo/.nvm/versions/node/v12.19.0/bin/node»
«/Users/juanpablo/.nvm/versions/node/v12.19.0/bin/npm» «run» «serve» 18 verbose
node v12.19.0 19 verbosenpm v6.14.8 20 error code ELIFECYCLE 21 error errno 1
22 error vue-dashboard@0.1.0 serve:`vue-cli-service serve` 22 error Exit status
1 23 error Failed at the vue-dashboard@0.1.0 serve script. 23 error This is
probably not a problem with npm. There is likely additional logging output
above. 24 verboseexit [ 1, true ]
<> Cause analysis :

package.json in webpack Version conflict .

<> Solution :

delete webpack, Reload previous version .
npm uninstall webpack
npm install webpack@^4.0.0 —save-dev

#node.js #vue.js #npm #vuejs2

#node.js #vue.js #npm #vuejs2

Вопрос:

Итак, у меня есть проект vuejs, над которым я работаю, и мне пришлось переустановить модуль npm node, поэтому я запустил NPM INSTALL. После запуска команды и попытки запустить сервер разработки он показал мне много ошибок. Я попробовал удалить node_modules и package.json.блокировка и повторная установка NPM, но возникли те же ошибки. Как я могу решить эту проблему, пожалуйста? Заранее спасибо! Это ошибки.

   "exclude": [
    null
  ],
  "use": [
    {
      "loader": "/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js",
      "options": {
        "cacheDirectory": "/Users/me/Desktop/projects/my_project/node_modules/.cache/babel-loader",
        "cacheIdentifier": "3763ed20"
      },
      "ident": "clonedRuleSet-38[0].rules[0].use[0]"
    },
    {
      "loader": "/Users/me/Desktop/projects/my_project/node_modules/babel-loader/lib/index.js",
      "options": "undefined",
      "ident": "undefined"
    }
  ]
}
Error: Rule can only have one resource source (provided resource and test   include   exclude) in {
  "exclude": [
    null
  ],
  "use": [
    {
      "loader": "/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js",
      "options": {
        "cacheDirectory": "/Users/me/Desktop/projects/my_project/node_modules/.cache/babel-loader",
        "cacheIdentifier": "3763ed20"
      },
      "ident": "clonedRuleSet-38[0].rules[0].use[0]"
    },
    {
      "loader": "/Users/me/Desktop/projects/my_project/node_modules/babel-loader/lib/index.js",
      "options": "undefined",
      "ident": "undefined"
    }
  ]
}
    at checkResourceSource (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:167:11)
    at Function.normalizeRule (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:198:4)
    at rules.map (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:110:20)
    at Array.map (<anonymous>)
    at Function.normalizeRules (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:109:17)
    at new RuleSet (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/RuleSet.js:104:24)
    at new NormalModuleFactory (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/NormalModuleFactory.js:115:18)
    at Compiler.createNormalModuleFactory (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:636:31)
    at Compiler.newCompilationParams (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:653:30)
    at Compiler.compile (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:661:23)
    at compiler.hooks.watchRun.callAsync.err (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/Watching.js:77:18)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/tapable/lib/Hook.js:154:20)
    at Watching._go (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/Watching.js:41:32)
    at Watching.compiler.readRecords.err (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/Watching.js:33:9)
    at Compiler.readRecords (/Users/me/Desktop/projects/my_project/node_modules/@vue/cli-service/node_modules/webpack/lib/Compiler.js:529:11)
npm ERR! code 1
npm ERR! path /Users/me/Desktop/projects/my_project
npm ERR! command failed
npm ERR! command sh -c vue-cli-service serve

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2020-11-25T22_35_03_818Z-debug.log```
 

Комментарии:

1. Возможно, попробуйте переустановить Vue CLI

2. @Chez повезло?

3. @Grandizer — да, я действительно решил эту проблему. Я нашел это прямо здесь: blog.meathill.com/fe-tool-chain /…

Ответ №1:

У меня была такая же ошибка, когда я пытался включить sass в свой проект, и это сработало для меня:

 npm install -D sass-loader node-sass
 

Понравилась статья? Поделить с друзьями:
  • Error rpc failed curl 18 transfer closed with outstanding read data remaining
  • Error root this bundle is not valid
  • Error root device mounted successfully but sbin init does not exist
  • Error romon is not enabled on the router mikrotik
  • Error romon agent not found add it to managed list