question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot start nuxt: Package subpath './nuxt' is not defined by "exports"

See original GitHub issue

I setup a nuxt module following the (limited) docs and the module starter template.

The playground works, but whenever I want to build and use it in my main nuxt application (using pnpm and file:../ui), I get following error output:

Nuxt CLI v3.0.0-rc.8                                                  09:15:59
                                                                      09:16:02
  > Local:    http://localhost:8080/
  > Network:  http://10.11.12.43:8080/


 ERROR  Cannot start nuxt:  Package subpath './nuxt' is not defined by "exports" in /Users/jclaessens/dev/proj/packages/nuxt3_web/node_modules/@skyebase/ui/package.json

  at new NodeError (node:internal/errors:371:5)
  at throwExportsNotFound (node:internal/modules/esm/resolve:453:9)
  at packageExportsResolve (node:internal/modules/esm/resolve:729:3)
  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 Function._resolve [as resolve] (/Users/jclaessens/dev/proj/node_modules/.pnpm/jiti@1.14.0/node_modules/jiti/dist/jiti.js:1:108226)
  at resolveModule (/Users/jclaessens/dev/proj/node_modules/.pnpm/@nuxt+kit@3.0.0-rc.8_webpack@5.74.0/node_modules/@nuxt/kit/dist/index.mjs:253:29)
  at normalizeModule (/Users/jclaessens/dev/proj/node_modules/.pnpm/@nuxt+kit@3.0.0-rc.8_webpack@5.74.0/node_modules/@nuxt/kit/dist/index.mjs:462:18)

npx nuxi info output:

❯ npx nuxi info
Nuxt CLI v3.0.0-rc.8                                                                                                                                                                  09:30:16
RootDir: /Users/jclaessens/dev/proj/packages/nuxt3_web                                                                                                                    09:30:18
Nuxt project info:                                                                                                                                                                    09:30:18

------------------------------
- Operating System: `Darwin`
- Node Version:     `v16.14.0`
- Nuxt Version:     `3.0.0-rc.8`
- Package Manager:  `pnpm@7.9.0`
- Builder:          `vite`
- User Config:      `ssr`, `typescript`, `css`, `modules`, `runtimeConfig`
- Runtime Modules:  `@vueuse/nuxt@8.9.4`, `proj/nuxt@1.0.0`
- Build Modules:    `-`
------------------------------

👉 Report an issue: https://github.com/nuxt/framework/issues/new                                                                                                                      09:30:18

👉 Suggest an improvement: https://github.com/nuxt/framework/discussions/new

👉 Read documentation: https://v3.nuxtjs.org

I configured the module as proj/ui/nuxt and I’m sure I build it first using the prepack command.

Any pointers on what it could be?

(I replaced the real namespaced project name with proj)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danielroecommented, Aug 16, 2022

Yes, a reproduction would be helpful, thanks.

0reactions
jclaessens97commented, Sep 28, 2022

Great! (in response to a message that read: “And now it seems to be working fine 👌”)

Yeah, my bad, I removed it since I was a bit too quick 😅

I managed to get it working, but there is still something off.

For the repro to work, I have to run dev:prepare before prepack, and then install it in the main app, so not sure if this is intended behavior or not. If it is, then it’s working correctly I suppose…

I’m still investigating though because in my real app it’s still not working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
I suddenly start receiving this error starting several minutes ago while deploying ... package.json' is not defined by "exports" Error #8498.
Read more >
0 - Stack Overflow
I'm trying to deploy my Nuxt.js site to Vercel but I get this error while deploying: Error! Package subpath './package.json' is not defined...
Read more >
ES Modules · Nuxt Concepts
ES Modules. This guide helps explain what ES Modules are and how to make a Nuxt app (or upstream library) compatible with ESM....
Read more >
Nuxt configuration file
This option lets you configure various settings for the build step, including loaders , filenames , the webpack config and transpilation . nuxt.config.js...
Read more >
vite exports is not defined | The AI Search Engine You Control
Describe the bug. error: exports is not defined when using ViteDevServer.ssrLoadModule with the following setups: package.json.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found