nuxt: Missing "./server-renderer" specifier in "vue" package
Environment
- Operating System:
Darwin - Node Version:
v14.18.1 - Nuxt Version:
3.2.1 - Nitro Version:
2.2.2 - Package Manager:
yarn@1.22.18 - Builder:
vite - User Config:
typescript,modules,build,runtimeConfig,pwa,imports - Runtime Modules:
@kevinmarrec/nuxt-pwa@0.10.0,@pinia/nuxt@0.4.6,@nuxtjs/tailwindcss@6.4.1,nuxt-typed-router@2.3.5 - Build Modules:
-
Reproduction
run yarn build command
Describe the bug
Getting “Missing “./server-renderer” specifier in “vue” package” on build process
Additional context
Everything is fine on Nuxt 3.1.1. Started to get the error on 3.2.0 and 3.2.1
Logs
[commonjs--resolver] Missing "./server-renderer" specifier in "vue" package
ERROR Missing "./server-renderer" specifier in "vue" package 18:42:19
at e (node_modules/vite/dist/node/chunks/dep-9912c491.js:14845:25)
at n (node_modules/vite/dist/node/chunks/dep-9912c491.js:14845:627)
at o (node_modules/vite/dist/node/chunks/dep-9912c491.js:14845:1276)
at resolveExports (node_modules/vite/dist/node/chunks/dep-9912c491.js:22032:20)
at resolveDeepImport (node_modules/vite/dist/node/chunks/dep-9912c491.js:22051:31)
at tryNodeResolve (node_modules/vite/dist/node/chunks/dep-9912c491.js:21736:20)
at Object.resolveId (node_modules/vite/dist/node/chunks/dep-9912c491.js:21487:28)
at Object.handler (node_modules/vite/dist/node/chunks/dep-9912c491.js:44849:19)
at node_modules/rollup/dist/es/shared/rollup.js:24011:40
at async PluginDriver.hookFirstAndGetPlugin (node_modules/rollup/dist/es/shared/rollup.js:23911:28)
at async resolveId (node_modules/rollup/dist/es/shared/rollup.js:22855:26)
at async ModuleLoader.resolveId (node_modules/rollup/dist/es/shared/rollup.js:23119:15)
at async Object.resolveId (node_modules/vite/dist/node/chunks/dep-9912c491.js:7972:10)
at async PluginDriver.hookFirstAndGetPlugin (node_modules/rollup/dist/es/shared/rollup.js:23911:28)
at async resolveId (node_modules/rollup/dist/es/shared/rollup.js:22855:26)
at async ModuleLoader.resolveId (node_modules/rollup/dist/es/shared/rollup.js:23119:15)
at async node_modules/rollup/dist/es/shared/rollup.js:23407:50
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 17 (8 by maintainers)
Checking I see that @CodyBontecou’s reproduction also has Vue 2 installed: https://github.com/CodyBontecou/server-renderer-error/blob/main/package-lock.json#L15893.
I think we can close this. If you’re encountering the original error, please check that you do not have Vue 2 installed in your dependencies. It is being hoisted to the top level of node modules and is causing vite to be unable to import from
vue/server-renderer, which only exists in Vue 3. You may be able to work around it by explicitly installingvue.A quick update - @danielroe noticed that the linked package has no Vue 3 support and depends on Vue 2 (and it’s SSR renderer), thus is not usable with Nuxt 3.
update, it seems that adjusting the peer/dependencies of the components library addresses the issue
If the component has no Vue 3 support, there is no solution except “upgrading the component to Vue 3” or searching for a replacement.
Then it’d be the best to raise an issue in the package repo. Leaving open in case there is something we can improve on the Nuxt end though.
@danielroe Hi, here’s the reproduction
It’s seems due 3rd party packages
To reproduce you need: npm run build