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

Nuxt 2 to Bridge Migration: ERROR No "exports" main defined in node_modules/@nuxt/kit/package.json #716

Closed
andre-lergier opened this issue Mar 15, 2023 · 5 comments

Comments

@andre-lergier
Copy link

Environment

  • Operating System: Darwin
  • Node Version: v16.15.1
  • Nuxt Version: 2.16.2
  • Nitro Version: 1.0.0
  • Package Manager: npm@8.11.0
  • Builder: webpack
  • User Config: target, bridge, head, loading, css, plugins, buildModules, modules, bootstrapVue, axios, sitemap, markdownit, content, googleAnalytics, build, serverHandlers, devServerHandlers, devServer, typescript
  • Runtime Modules: @nuxtjs/eslint-module@3.1.0, bootstrap-vue/nuxt, @nuxtjs/axios@5.13.6, @nuxtjs/sitemap@2.4.0, @nuxtjs/markdownit@2.0.0, @nuxtjs/svg@0.4.0, @nuxt/content@2.5.2, nuxt-gmaps@1.2.10
  • Build Modules: (), @nuxtjs/google-analytics@2.4.0, @nuxtjs/fontawesome@1.1.2, @nuxt/bridge@3.0.0-27928371.c30fa0f

Reproduction

Describe the bug

I followed the migration guide from Nuxt 2 to Nuxt Bridge carefully: https://nuxt.com/docs/bridge/overview

As soon as I try to run npm run dev or any new nuxi script I just get the following error:

Nuxi 3.1.2    
Nuxt 2.16.2 with Nitro 1.0.0              

 ERROR  No "exports" main defined in /Users/[myUser]/Developer/Projects/[myRepo]/node_modules/@nuxt/kit/package.json                                                                                                                                                          11:40:13

  at new NodeError (node:internal/errors:372:5)
  at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)
  at packageExportsResolve (node:internal/modules/esm/resolve:693:7)
  at resolveExports (node:internal/modules/cjs/loader:482:36)
  at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
  at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
  at Function.resolve (node:internal/modules/cjs/helpers:108:19)
  at resolveModule (node_modules/nuxi/dist/shared/nuxi.f17c7643.mjs:17:29)
  at importModule (node_modules/nuxi/dist/shared/nuxi.f17c7643.mjs:37:24)
  at loadKit (node_modules/nuxi/dist/shared/nuxi.ede95f37.mjs:5:18)

I deleted my node_modules folder and the package-lock.json and reinstalled everything but it doesn't make a difference, I always get the same error.

I found some issues on GitHub who reported the same error but their solution somehow does not fit my case.

Additional context

I need to update my swiper integration in my Nuxt 2 project. Therefore I'd like to use the nuxt-swiper module. To be able to use this, I thought that I need to use the Nuxt bridge.

Logs

No response

@danielroe
Copy link
Member

danielroe commented Mar 16, 2023

Would you provide a reproduction? 🙏

@wattanx
Copy link
Collaborator

wattanx commented Mar 17, 2023

I believe this problem has been resolved with the following fix.
nuxt-modules/web-vitals#64

@danielroe
Copy link
Member

Let me know if not; I'm happy to reopen.

@andre-lergier
Copy link
Author

I can confirm it's fixed.
Thank you very much!

@ali-hasani-clp
Copy link

The same error with @nuxjs/apollo !

  • Operating System: Darwin
  • Node Version: v20.12.2
  • Nuxt Version: 2.17.3
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: npm@10.5.0
  • Builder: vite
  • User Config: bridge, typescript, serverMiddleware, server, vue, head, publicRuntimeConfig, env, css, plugins, components, modules, sentry, axios, router, apollo, build, alias, vite, serverHandlers, devServerHandlers, devServer, nitro, buildModules
  • Runtime Modules: bootstrap-vue/nuxt, @nuxtjs/universal-storage@0.5.9, @nuxtjs/axios@5.13.6, @nuxtjs/apollo@5.0.0-alpha.14, @nuxtjs/sentry@8.0.7
  • Build Modules: (), @nuxt/bridge@3.2.0

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

4 participants