Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule can only have one resource source #8277

Closed
Nainterceptor opened this issue Nov 1, 2020 · 41 comments
Closed

Rule can only have one resource source #8277

Nainterceptor opened this issue Nov 1, 2020 · 41 comments

Comments

@Nainterceptor
Copy link

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-nuxt-app v3.4.0
✨  Generating Nuxt.js project in docs
? Project name: docs
? Programming language: JavaScript
? Package manager: Npm
? UI framework: Bulma
? Nuxt.js modules: Progressive Web App (PWA)
? Linting tools: ESLint
? Testing framework: None
? Rendering mode: Single Page App
? Deployment target: Static (Static/JAMStack hosting)
? Development tools: (Press <space> to select, <a> to toggle all, <i> to invert selection)
? Continuous integration: None
? Version control system: Git

Some warnings may help to understood the issue :

npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN node_modules/eslint-plugin-vue
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN node_modules/eslint-plugin-vue
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN node_modules/eslint-plugin-vue
npm WARN   eslint-plugin-vue@"^6.2.2" from @nuxtjs/eslint-config@3.1.0
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN node_modules/eslint-plugin-vue
npm WARN   eslint-plugin-vue@"^6.2.2" from @nuxtjs/eslint-config@3.1.0
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN node_modules/eslint-plugin-vue
npm WARN   eslint-plugin-vue@"^6.2.2" from @nuxtjs/eslint-config@3.1.0
npm WARN   node_modules/@nuxtjs/eslint-config
npm WARN   1 more (eslint-plugin-nuxt)
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN node_modules/eslint-plugin-vue
npm WARN   eslint-plugin-vue@"^6.2.2" from @nuxtjs/eslint-config@3.1.0
npm WARN   node_modules/@nuxtjs/eslint-config
npm WARN   1 more (eslint-plugin-nuxt)
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN node_modules/eslint-plugin-vue
npm WARN   eslint-plugin-vue@"^6.2.2" from @nuxtjs/eslint-config@3.1.0
npm WARN   node_modules/@nuxtjs/eslint-config
npm WARN   1 more (eslint-plugin-nuxt)
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint@7.12.1
npm WARN node_modules/eslint
npm WARN   dev eslint@"^7.10.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0" from eslint-plugin-vue@6.2.2
npm WARN node_modules/eslint-plugin-vue
npm WARN   eslint-plugin-vue@"^6.2.2" from @nuxtjs/eslint-config@3.1.0
npm WARN   node_modules/@nuxtjs/eslint-config
npm WARN   1 more (eslint-plugin-nuxt)
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: webpack@5.3.2
npm WARN node_modules/webpack
npm WARN   peer webpack@"^4.0.0 || ^5.0.0" from eslint-loader@4.0.2
npm WARN   node_modules/eslint-loader
npm WARN     eslint-loader@"^4.0.2" from @nuxtjs/eslint-module@2.0.0
npm WARN     node_modules/@nuxtjs/eslint-module
npm WARN 
npm WARN Could not resolve dependency:

What is Expected?

It should run and be available through localhost:3000

What is actually happening?

Build fail with the following error :


 ERROR  Rule can only have one resource source (provided resource and test + include + exclude) in {                                                                                                                          14:15:02
  "use": [
    {
      "loader": "/<absolute path>/gitlab-templates/docs/node_modules/babel-loader/lib/index.js",
      "options": {
        "configFile": false,
        "babelrc": false,
        "cacheDirectory": true,
        "envName": "client",
        "presets": [
          [
            "/<absolute path>/node_modules/@nuxt/babel-preset-app/src/index.js",
            {
              "corejs": {
                "version": 3
              }
            }
          ]
        ]
      },
      "ident": "clonedRuleSet-4[0].rules[0].use[0]"
    }
  ]
}

  "use": [
  {
  "loader": "node_modules/babel-loader/lib/index.js",
  "options": {
  "configFile": false,
  "babelrc": false,
  "cacheDirectory": true,
  "envName": "client",
  "presets": [
  [
  "node_modules/@nuxt/babel-preset-app/src/index.js",
  {
  "corejs": {
  "version": 3
  }
  }
  ]
  ]
  },
  "ident": "clonedRuleSet-4[0].rules[0].use[0]"
  }
  ]
  }
  at checkResourceSource (node_modules/@nuxt/webpack/node_modules/webpack/lib/RuleSet.js:167:11)
  at Function.normalizeRule (node_modules/@nuxt/webpack/node_modules/webpack/lib/RuleSet.js:198:4)
  at node_modules/@nuxt/webpack/node_modules/webpack/lib/RuleSet.js:110:20
  at Array.map (<anonymous>)
  at Function.normalizeRules (node_modules/@nuxt/webpack/node_modules/webpack/lib/RuleSet.js:109:17)
  at new RuleSet (node_modules/@nuxt/webpack/node_modules/webpack/lib/RuleSet.js:104:24)
  at new NormalModuleFactory (node_modules/@nuxt/webpack/node_modules/webpack/lib/NormalModuleFactory.js:115:18)
  at Compiler.createNormalModuleFactory (node_modules/@nuxt/webpack/node_modules/webpack/lib/Compiler.js:636:31)
  at Compiler.newCompilationParams (node_modules/@nuxt/webpack/node_modules/webpack/lib/Compiler.js:653:30)
  at Compiler.compile (node_modules/@nuxt/webpack/node_modules/webpack/lib/Compiler.js:661:23)
  at node_modules/@nuxt/webpack/node_modules/webpack/lib/Watching.js:77:18
  at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
  at AsyncSeriesHook.lazyCompileHook (node_modules/tapable/lib/Hook.js:154:20)
  at Watching._go (node_modules/@nuxt/webpack/node_modules/webpack/lib/Watching.js:41:32)
  at node_modules/@nuxt/webpack/node_modules/webpack/lib/Watching.js:33:9
  at Compiler.readRecords (node_modules/@nuxt/webpack/node_modules/webpack/lib/Compiler.js:529:11)

Workaround

Issue seems to be located in npm dependencies resolution, If I remove @nuxtjs/eslint-module in dependencies, remove package-lock and rerun npm install, it's solving the issue.

@manniL
Copy link
Member

manniL commented Nov 1, 2020

cc @ricardogobbosouza

@campbell000
Copy link

Same issue here, although the fix mentioned above about removing eslint doesn't seem to fix the issue for me.

@Nainterceptor
Copy link
Author

Same issue here, although the fix mentioned above about removing eslint doesn't seem to fix the issue for me.

I've noticed that other dependencies are causing the same issue, like sass-loader, maybe more annoying than eslint :/

@campbell000
Copy link

FYI, I redid the same layout of my previous project (essentially following https://nuxtjs.org/blog/creating-blog-with-nuxt-content/#installation), but with yarn instead of npm, and did NOT run into the same issue. Maybe that would help the maintainers narrow down the issue?

@shvebish
Copy link

shvebish commented Nov 2, 2020

same here, also because of the sass-loader

@jogunism
Copy link

jogunism commented Nov 2, 2020

same issue. It would be webpack 5.x. webpack 4.x lastest is working.

@rikless
Copy link

rikless commented Nov 3, 2020

got it too

@farhodhojiev
Copy link

Same error.
In my case:
Error: Rule can only have one resource source (provided resource and test + include + exclude) in { "use": [ { "loader": "D:\\05_ProjectS\\www\\hrdb3\\node_modules\\babel-loader\\lib\\index.js", "options": { "plugins": [ "@babel/plugin-proposal-optional-chaining", "@babel/plugin-proposal-nullish-coalescing-operator", "D:\\05_ProjectS\\www\\hrdb3\\node_modules\\@nuxtjs\\composition-api\\lib\\babel" ], "configFile": false, "babelrc": false, "cacheDirectory": true, "envName": "server", "presets": [ [ "D:\\05_ProjectS\\www\\hrdb3\\node_modules\\@nuxt\\babel-preset-app\\src\\index.js", { "corejs": { "version": 2 } } ] ] }, "ident": "clonedRuleSet-29[0].rules[0].use[0]" } ] }

@farhodhojiev
Copy link

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

@swearwalker
Copy link

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

didn't help for me

@jogunism
Copy link

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

didn't help for me

Me either. my node version is 14.x already.

@farhodhojiev
Copy link

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

didn't help for me

can you check npm version, it seems problem with npm v7.

@swearwalker
Copy link

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

didn't help for me

can you check npm version, it seems problem with npm v7.

my npm version 7.0.7. can u say me, which version fix that problem?

@farhodhojiev
Copy link

farhodhojiev commented Nov 11, 2020

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

didn't help for me

can you check npm version, it seems problem with npm v7.

my npm version 7.0.7. can u say me, which version fix that problem?

Try to install version 6, also delete node_modules folder and package-lock.json file, then run npm install.

@swearwalker
Copy link

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

didn't help for me

can you check npm version, it seems problem with npm v7.

my npm version 7.0.7. can u say me, which version fix that problem?

Try to install version 6, also delete node_modules folder and package-lock.json file, then run npm install.

that solved my problem. thx

@Zebnastien
Copy link

Zebnastien commented Nov 12, 2020

Same issue here.

Solved installing Node LTS 14.15 instead of Current 15.2

@cheap-glitch
Copy link

Try to install version 6, also delete node_modules folder and package-lock.json file, then run npm install.

You don't need to downgrade npm... just use the --legacy-peer-deps flag when installing. Worked fine for me.

@shvebish
Copy link

Problem is compatibility with nodejs 15, downgrade to 14 and my problem solved.

didn't help for me

can you check npm version, it seems problem with npm v7.

my npm version 7.0.7. can u say me, which version fix that problem?

Try to install version 6, also delete node_modules folder and package-lock.json file, then run npm install.

that solved my problem. thx

I'm using npm version 6.14.8 and it's not working...

@cssagogo
Copy link

Try to install version 6, also delete node_modules folder and package-lock.json file, then run npm install.

You don't need to downgrade npm... just use the --legacy-peer-deps flag when installing. Worked fine for me.

@cheap-glitch - I'm not familiar with --legacy-peer-deps. Can you explain how it is used or point to some documentation on it?

@cssagogo
Copy link

Per @cheap-glitch's suggestion, I deleted my node_modules folder and package-lock.json file and ran npm i --legacy-peer-deps and then npm run dev and it worked as expected. I'm on npm 7.0.3 and node v15.0.1 and have following in my package.json file...

{
  "name": "src",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "test": "jest"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.12.2",
    "@nuxtjs/pwa": "^3.0.2",
    "core-js": "^3.6.5",
    "isomorphic-fetch": "^3.0.0",
    "nuxt": "^2.14.6"
  },
  "devDependencies": {
    "@nuxtjs/vuetify": "^1.11.2",
    "@vue/test-utils": "^1.1.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "^26.5.0",
    "eslint-config-prettier": "^6.12.0",
    "eslint-plugin-prettier": "^3.1.4",
    "jest": "^26.5.0",
    "prettier": "^2.1.2",
    "vue-jest": "^3.0.4"
  }
}

@cheap-glitch
Copy link

cheap-glitch commented Nov 17, 2020

@cheap-glitch - I'm not familiar with --legacy-peer-deps. Can you explain how it is used or point to some documentation on it?

@cssagogo AFAIK it was introduced in a v7 beta a few months ago: https://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major

@stale
Copy link

stale bot commented Dec 19, 2020

Thanks for your contribution to Nuxt!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

@stale stale bot added the stale label Dec 19, 2020
@ibrahimBeladi
Copy link

Remove stale.

@stale stale bot removed the stale label Dec 20, 2020
@stale
Copy link

stale bot commented Jan 23, 2021

Thanks for your contribution to Nuxt!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

@stale stale bot added the stale label Jan 23, 2021
@tsega
Copy link

tsega commented Jan 24, 2021

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"
  }
}

@stale stale bot removed the stale label Jan 24, 2021
@AndersNielsen85
Copy link

AndersNielsen85 commented Jan 27, 2021

Seeing the same error as others. Don't know if it is related, but it seems there is a dependency to an old version of core-js somewhere. It does seem the error is gone using nuxt 2.15 though #8591

From package-lock.json:

"node_modules/@nuxt/babel-preset-app": {
"version": "2.14.12",
"resolved": "https://registry.npmjs.org/@nuxt/babel-preset-app/-/babel-preset-app-2.14.12.tgz",
"integrity": "sha512-6qAW5i4F+nCRWyGBytJAEJ/P0yH9RpYmIqWwkzQd1GQ1EuO1Fuc9QoOmmzbs+3MrwW7HzpQ5jJtLDuzhQ+e5/w==",
"dependencies": {
"@babel/core": "^7.12.9",
"@babel/helper-compilation-targets": "^7.12.5",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.1",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
"@babel/plugin-proposal-optional-chaining": "^7.12.7",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.12.7",
"@babel/runtime": "^7.12.5",
"@vue/babel-preset-jsx": "^1.2.4",
"core-js": "^2.6.5"
}
},
"node_modules/@nuxt/babel-preset-app/node_modules/core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==",
"deprecated": "core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.",
"hasInstallScript": true
},

@ReindDooyeweerd
Copy link

ReindDooyeweerd commented Feb 11, 2021

Same issue here today so it doesn't seem to be resolved, i got exactly the same error as @AndersNielsen85 had.

Node version: v14.15.0
NPM: 7.5.2
Latest version of NuxtJS

Edit: Fixed it by switching back to "sass-loader": "^10.1.1". Not really a fix but at least i can work on finishing a project ;)

@gilles6
Copy link

gilles6 commented Mar 1, 2021

Removing @nuxtjs/eslint-module from package.json is still the only way I could fix it:

rm -rf node_modules
rm package-lock.json
npm i
npm run dev

Copy link
Member

danielroe commented Mar 22, 2021

I'm closing this as I can't reproduce using the original installation steps above, and there are indications it is no longer occurring in Nuxt 2.15+

@tsega
Copy link

tsega commented Mar 29, 2021

After much trial and error, I think I've found the issue. It's Webpack v5.x!

If you are using Node v15.x and you run create-nuxt-app, I use NPM

npm init nuxt-app <project-name>

Then Webpack v5.x is installed. I switched to Node LTS (14.16.0) and re-created the application, now the application runs.

Looking into package-lock.json shows "webpack": "^4.46.0".

Here is a related Vue issue; vuejs/vue-cli#5986

Copy link
Member

@tsega I'm glad you've sorted it out! Newer versions of Nuxt should also help by printing out a warning if Webpack 5 is detected.

@cosbgn
Copy link

cosbgn commented May 10, 2021

You can fix it by pinning webpack: npm i -D webpack@^4.46.0 - Not the best solution but works

@marcelofern
Copy link

Having the same problem in a fresh install.

@Robotechnic
Copy link

Per @cheap-glitch's suggestion, I deleted my node_modules folder and package-lock.json file and ran npm i --legacy-peer-deps and then npm run dev and it worked as expected. I'm on npm 7.0.3 and node v15.0.1 and have following in my package.json file...

This solve my problem

@fahmisatrio
Copy link

You can fix it by pinning webpack: npm i -D webpack@^4.46.0 - Not the best solution but works

having same problem with fresh install and solved with changing webpack version.
thanks

@Adamskoullos
Copy link

Update: Its 24th August 2021 and this issue came up once I installed sass-loader with v2.15.8, I have tried the solutions discussed above to no avail. Thanks

@tsega
Copy link

tsega commented Aug 24, 2021

@Adamskoullos can you share your package.json for some context.

@Adamskoullos
Copy link

Hi thanks for responding. Sorry I have not got the previous pakcage.json file but I did manage to find the solution for my issue:

I was using this command to add sass and loader which was causing the above error. This was installing version 12:
npm install --save-dev node-sass sass-loader

Once I used the command within the Nuxt docs I had no issues, which installed version 10:
npm install --save-dev sass sass-loader@10 fibers

For further context, I was adding the style-resources module so my team can pull in and customise bootstrap 5.

The above works nicely now.
Thanks

Liu233w added a commit to Liu233w/acm-statistics that referenced this issue Nov 7, 2021
Downgrade stylus-loader for webpack 4, and rebuild the dependency to fix npm dev issues.

See nuxt/nuxt#8277
mergify bot pushed a commit to Liu233w/acm-statistics that referenced this issue Nov 7, 2021
Downgrade stylus-loader for webpack 4, and rebuild the dependency to fix npm dev issues.

See nuxt/nuxt#8277
@Ramadanko
Copy link

Ramadanko commented Nov 30, 2021

@vout thank you, it works for me after changing/installing node-sass

@imduchy
Copy link

imduchy commented Dec 31, 2021

Downgrading ts-loader, webpack and webpack-cli solved the issue for me. Thanks for tips 👍🏼

{
  "ts-loader": "^8.2.0", // omit if you don't use TypeScript
  "webpack": "^4.46.0",
  "webpack-cli": "^4.9.1"
}

@Voltra
Copy link

Voltra commented Mar 16, 2023

For those still encountering this issue, here's what I had as a "problematic dependencies":

  • @storybook/vue^6.5.12 which has a peer-dep to css-loader@* (that's scary) and its latest version has a peer dep on webpack@^5.0.0
  • @nuxtjs/storybook@^4.3.2
  • @nuxtjs/style-resources@^1.2.1
  • sass-loader@^10.2.0
  • vue-jest@^3.0.7
  • babel-jest@^29.5.0
  • jest@^29.5.0

Therefore I solved it by:

  • Installing css-loader@^5.2.7 so the peer dep can be satisfied by webpack 4
  • Installing webpack@^4.46.0
  • Change sass-loader to sass-loader@^10.1.1

Node v14.21
NPM v9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests