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.22k stars 790 forks source link

Error on nanoid #464

Closed 1Map closed 6 months ago

1Map commented 7 months ago

My node version: v20.11.0 My npm version: 10.3.0 My nanoid version: 5.0.4

Error when I run:

Uncaught SyntaxError file:///C:/testapp/node_modules/nanoid/index.js:1
import { webcrypto as crypto } from 'node:crypto'
         ^^^^^^^^^
SyntaxError: The requested module 'node:crypto' does not provide an export named 'webcrypto'
ai commented 7 months ago

Are you sure, that you use Node.js 20?

https://nodejs.org/api/webcrypto.html#web-crypto-api