bridge: isWindow not found

Environment

Nuxt CLI v3.0.0-27287661.1e0e881 23:09:16 RootDir: L:\adirani\app 23:09:17 Nuxt project info: 23:09:17


  • Operating System: Windows_NT
  • Node Version: v16.13.0
  • Nuxt Version: 2.16.0-27286577.ab1c6cb4
  • Package Manager: npm@8.1.0
  • Bundler: Webpack
  • User Config: target, head, css, plugins, components, buildModules, generate, modules, axios, pwa, build, serverMiddleware, env
  • Runtime Modules: @nuxtjs/axios@5.13.6, @nuxtjs/pwa@3.3.5
  • Build Modules: @nuxtjs/tailwindcss@4.2.1, @nuxt/bridge@3.0.0-27287661.1e0e881

👉 Report an issue: https://github.com/nuxt/framework/issues/new 23:09:17

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

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

Reproduction

When I run

npm run build

Describe the bug

After running npm run build got the following error

 FATAL  [worker] Named export 'isWindows' not found. The requested module 'std-env' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'std-env';
const { provider, isWindows } = pkg;


  import { provider, isWindows } from 'std-env';
  ^^^^^^^^^
  SyntaxError: Named export 'isWindows' not found. The requested module 'std-env' is a CommonJS module, which may not support all module.exports as named exports.
  CommonJS modules can always be imported via the default export, for example using:

  import pkg from 'std-env';
  const { provider, isWindows } = pkg;

  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
  at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)
  at async Promise.all (index 0)
  at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
  at async loadESM (node:internal/process/esm_loader:88:5)
  at async handleMainPromise (node:internal/modules/run_main:65:12)


   ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
   │                                                                                                   │
   │   ✖ Nuxt Fatal Error                                                                              │
   │                                                                                                   │
   │   SyntaxError: [worker] Named export 'isWindows' not found. The requested module 'std-env' is a   │
   │   CommonJS module, which may not support all module.exports as named exports.                     │
   │   CommonJS modules can always be imported via the default export, for example using:              │
   │                                                                                                   │
   │   import pkg from 'std-env';                                                                      │
   │   const { provider, isWindows } = pkg;                                                            │
   │                                                                                                   │
   │                                                                                                   │
   ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯


 ERROR  Command failed with exit code 1: npx nuxt generate                                                    23:03:02

  at makeError$1 (/L:/adirani/app/node_modules/nuxi/dist/chunks/generate.mjs:1083:11)
  at handlePromise (/L:/adirani/app/node_modules/nuxi/dist/chunks/generate.mjs:1772:26)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async Object.invoke (/L:/adirani/app/node_modules/nuxi/dist/chunks/generate.mjs:1942:7)
  at async _main (/L:/adirani/app/node_modules/nuxi/dist/chunks/index.mjs:386:7)

Additional context

No response

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 18 (6 by maintainers)

Most upvoted comments

I added std-env as devDependency.

I encountered this as well and my guess would be that it comes from @nuxt/telemetry which uses v2.3.0 of std-env. I got it working by manually updating the versions inside the lock-file, but I assume it would be a pretty simply PR to the telemetry to get it sorted (I can make one if that sounds like a good fix).

No, you can upgrade your dependencies or refresh your lockfile manually.

I added std-env as devDependency.

Thank you, I had the same issue today while following the bridge installation steps, and installing std-dev solved the problem.

Tip: you can use npx nuxi upgrade --force to update all deps. It should fix the issue. Also check using latest version of nuxt-edge