Skip to content

[BUG] importing UUID causes an 'Element type is invalid' error #651

@BeetrootShoulders

Description

@BeetrootShoulders

Before you begin...

  • I have searched the existing issues
  • I am not using version 13.x of node (if so, please upgrade)

Description of the problem

Importing uuid into a Next.js component using the method in the docs:

import { v4 as uuidv4 } from "uuid";

causes an error:

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Recipe for reproducing

Import UUID into a Next component.

Additional information

No response

Environment

System:
    OS: Windows 10 10.0.22000
    CPU: (12) x64 Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
    Memory: 1.33 GB / 7.75 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.15 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (104.0.1293.63)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    @babel/preset-react: ^7.18.6 => 7.18.6 
    @sanity/client: ^3.3.3 => 3.3.3 
    @sanity/image-url: ^1.0.1 => 1.0.1 
    autoprefixer: ^10.4.8 => 10.4.8 
    eslint: 8.22.0 => 8.22.0 
    eslint-config-next: 12.2.5 => 12.2.5 
    moment: ^2.29.4 => 2.29.4 
    next: 12.2.5 => 12.2.5 
    postcss: ^8.4.16 => 8.4.16 
    react: 18.2.0 => 18.2.0 
    react-dom: 18.2.0 => 18.2.0 
    tailwindcss: ^3.1.8 => 3.1.8 
    uuid: ^8.3.2 => 8.3.2 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions