image: Receiving `Cannot read properties of undefined (reading 'get') on version 0.6.1`

Version 0.6.1 broke something when running nuxt generate and I’m not sure what it is.

Please see the error I get below:

FATAL  Cannot read properties of undefined (reading 'get')

  at _interopNamespace (node_modules/@nuxt/image/dist/module.js:26:39)
  at node_modules/@nuxt/image/dist/module.js:290:83
  at async ModuleContainer.imageModule2 (node_modules/@nuxt/image/dist/module.js:290:20)
  at async ModuleContainer.addModule (node_modules/@nuxt/core/dist/core.js:239:20)
  at async ModuleContainer.ready (node_modules/@nuxt/core/dist/core.js:55:5)
  at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:478:5)

   ╭────────────────────────────────────────────────────────────────────╮
   │                                                                    │
   │   ✖ Nuxt Fatal Error                                               │
   │                                                                    │
   │   TypeError: Cannot read properties of undefined (reading 'get')   │
   │                                                                    │
   ╰────────────────────────────────────────────────────────────────────╯

Nuxt version: 2.15.8

About this issue

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

Commits related to this issue

Most upvoted comments

same happened with me after upgraded 0.6.0 to 0.6.1 using nuxt 2

I think it’s related to Rollup:

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  const n = Object.create(null);
  if (e) {
    for (const k in e) {
      if (k !== 'default') {
        const d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : { // <--- this breaks since d is undefined
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    }
  }
  n["default"] = e;
  return Object.freeze(n);
}

Temporary fix Adding optional chaining solves the issue in my case and lets the build succeed: Object.defineProperty(n, k, d?.get ? d : {

The _interopNamespace function is part of Rollup’s esModuleInterop functionality: https://rollupjs.org/guide/en/#outputinterop

~Even though I am pretty sure I did exactly this before, I deleted yarn.lock and ran yarn install && yarn upgrade and now it is fixed for me 👍~

Edit: Nope, sorry, did not solve it after all 😕

The issue should be solved in 0.6.2.

Traceback seems related to the lru-cache import but I cannot reproduce it with a fresh installation of 2.15/2.16 with/without bridge and nuxt generate.

Can you please try to recreate lockfile (package.lock.json / yarn.lock) if it solves issue or not?

I am having the same problem (upgraded from 0.6.0 to 0.6.1) I am on nuxt 2

I am having the same problem (upgraded from 0.6.0 to 0.6.1)

I am having the same problem (upgraded from 0.6.0 to 0.6.1)

I am on nuxt bridge