create-nuxt-app icon indicating copy to clipboard operation
create-nuxt-app copied to clipboard

Failed to load plugin errors

Open gitjeff05 opened this issue 3 years ago • 2 comments

MacOS 11.2.3
Node v14.15.3
Yarn 2.4.1

Hello, I've been getting errors after yarn create nuxt-app. Upon running yarn dev I could preview in browser, but then the preview would error out with:

Failed to load plugin 'import' declared in '.eslintrc.js » @nuxtjs/eslint-config': Your application tried to access eslint-plugin-import, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

Required package: eslint-plugin-import (via "eslint-plugin-import")
Required by: /Ronnie/million-dollar-ideas/camera-phone

So, I ran yarn add -D eslint-plugin-import and that resolved things. However, as I fixed one dependency, others threw similar errors:

  • json5
  • eslint-plugin-jest
  • eslint-plugin-unicorn
  • eslint-plugin-promise

The eslint-plugin-promise error would not go away after installing as dependency. I had to eventually add it to packageExtensions in .yarnrc.yml like so:

packageExtensions:
  eslint-config-standard:
    dependencies:
      eslint-plugin-promise: "*"

This seems to work. But I am wondering if this is the correct way? I'll admit I just upgraded to Yarn 2 and am not completely familiar.

gitjeff05 avatar Mar 18 '21 14:03 gitjeff05

Upon further examination, yarn was emitting the error YN0002 - MISSING_PEER_DEPENDENCY. Ultimately, I was able to get everything working by adding missing dependencies to my workspace with yarn add and by specifying missing peer dependencies in packageExtensions.

So, errors like:

YN0002: │ project@workspace:. doesn't provide vue (p{xxxx}), requested by @vue/test-utils

can be fixed by adding that dependency to your workspace with yarn add -D vue

and errors like:

YN0002: │ @nuxt/types@npm:2.15.3 doesn't provide webpack (p2e621), requested by sass-loader

can be fixed by adding the following to .yarnrc.yml:

packageExtensions:
  "@nuxt/types@*":
    dependencies:
      webpack: "*"  

Hopefully this can help someone.

gitjeff05 avatar Mar 19 '21 13:03 gitjeff05

Hi, create-nuxt-app doesn't support yarn v2 for now, we'll look into this issue.

clarkdo avatar Mar 26 '21 15:03 clarkdo