ai / nanoid

A tiny (124 bytes), secure, URL-friendly, unique string ID generator for JavaScript
https://zelark.github.io/nano-id-cc/
MIT License
24.33k stars 788 forks source link

Can't install with nest.js #402

Closed RostyslavKhrinovskyi closed 1 year ago

RostyslavKhrinovskyi commented 1 year ago

Node version: v14.17.6 Nest.js version: 9.0.0

after simple install npm i nanoid and import by import { nanoid } from 'nanoid' trying to ran application and get next error:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: require() of ES modules is not supported.

ai commented 1 year ago

Nest.js doesn’t support ESM applications. Switch to 3.x branch for now (4.x branch is only for ESM applications).

Don’t worry, 3.x branch is not outdated and still supported.