nuxt: 'setupDevtoolsPlugin' is not exported by `unenv`
Environment
NUXT 3 : 3.0.0-27497374.59593a0 NODE : 16.4.2 pnpm": “^6.32.3”
Reproduction
.
Describe the bug
when normaly build its fine.

Additional context
my nuxt config not set preset. when im build NITRO_PRESET=cloudflare pnpm build.
Logs
Error like this:
ERROR Rollup error: 'setupDevtoolsPlugin' is not exported by node_modules/.pnpm/unenv@0.4.6/node_modules/unenv/runtime/mock/proxy.mjs, imported by node_modules/.pnpm/pinia@2.0.13_d3195e5b5ca92757b2890fe178df3bd1/node_modules/pinia/dist/pinia.mjs
ERROR 'setupDevtoolsPlugin' is not exported by node_modules/.pnpm/unenv@0.4.6/node_modules/unenv/runtime/mock/proxy.mjs, imported by node_modules/.pnpm/pinia@2.0.13_d3195e5b5ca92757b2890fe178df3bd1/node_modules/pinia/dist/pinia.mjs
at error (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:1784:30)
at Module.error (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:12345:16)
at Module.traceVariable (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:12703:29)
at ModuleScope.findVariable (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:11333:39)
at FunctionScope.findVariable (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:6301:38)
at ChildScope.findVariable (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:6301:38)
at Identifier.bind (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:7592:40)
at CallExpression.bind (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:5166:23)
at CallExpression.bind (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:8774:15)
at ExpressionStatement.bind (node_modules/.pnpm/rollup@2.70.1/node_modules/rollup/dist/es/shared/rollup.js:5166:23)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 43 (20 by maintainers)
The cause is that pinia imports
setupDevtoolsPluginfrom@vue/devtools-api. We deliberately stub out vue devtools on the server. So rollup, in trying to inline this function, fails.As a workaround, you can do:
Just upgraded to
v3.0.0-rc.8-27679173.c688e18and it’s working!@danielroe @pi0 Thank you so much for this blazing fast fix!
on RC4 and yarn
1.x, when i do the suggested workaround, when running a build (node .output/server/index.mjs) the errors changes to__VUE_PROD_DEVTOOLS__ is not defined. I do not use Vuex (only Pinia).I tried migrating to
yarn 3.2, it did not change the issue.It’s fine in developement (
yarn dev).Should be fixed in RC.5. You can remove workarounds.
It’s not a bug in
vue-router. It andpiniaboth import@vue/devtools-apifor the purpose of client-side integration. But that’s not something we want in our server code. It’s code that will never be used, so we mock it out in nitro (unenv). Ideally it wouldn’t be imported into the node code of either of them. But we can also stub it better.We’ve pinned vue-router in future edge/RC releases until we resolve: https://github.com/nuxt/framework/pull/5767
Change that to ~4.0.16
I’m using yarn v1.22.18 and also getting this; which indicates to me that it’s not pnpm related.
I have the same problem
any solution ?
Any news?
I am also seeing this with today’s latest v3.0.0-27506609.eed7036
You should definitely not install
@nuxtjs/composition-apiin a Nuxt 3 project. Make sure you are using the latest version of the pinia module.@danielroe
I am experiencing the same after upgrading to nuxt rc8. After checking the the dependencies linked above (vue-router and pinia) it now looks like it’s caused by @nuxtjs/i18n.
Here is a small reproduction repo (Nuxt 3 RC8 + nuxt-i18n): https://stackblitz.com/edit/nuxt-starter-dyand4?file=package.json
Would you ensure you can replicate after running
npx nuxi upgradeand if so, open a new issue witha reproduction? 🙏No need for further reproduction 👍
@pi0 I’ve provided a reproduction in this issue: https://github.com/nuxt/nuxt.js/issues/13751
n/a