create-nuxt-app
create-nuxt-app copied to clipboard
Failed to load plugin errors
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.
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.
Hi, create-nuxt-app doesn't support yarn v2 for now, we'll look into this issue.