Questions tagged [nanoid]

21 questions
10
votes
4 answers

Nanoid4 in codecept error [ERR_REQUIRE_ESM]: require() of ES Module

I updated to nanoid4 and began getting the following error: [ERR_REQUIRE_ESM]: require() of ES Module [...]/node_modules/nanoid/index.js not supported. Instead change the require of index.js in [...]/signup_test.ts to a dynamic import() which is…
meds
  • 21,699
  • 37
  • 163
  • 314
6
votes
3 answers

Nanoid can't be used in react-native

I don't know exactly what happened when I'm using the nanoid package in react native it's shown some kind of below error. I'm not sure about it. I hope someone help from this community. Thanks in advance. Scenario: I just import to the nanoid…
Mohamed Jakkariya
  • 1,257
  • 1
  • 13
  • 16
4
votes
1 answer

React Native - Unable to resolve module from @react-navigation. None of these files exist: node_modules/nanoid/non-secure/index.cjs

I have a React Native app that fails to build on both Android and iOS apps, (XCode, Android Studio, on a physical device). I have not changed anything inside package.json. The error is being caused by a file (useReigsterNavigator.js) inside of the…
mtracht
  • 41
  • 1
  • 3
3
votes
1 answer

how to install nanoid in NestJS

I tried importing nanoid into NestJS and got this error: Error [ERR_REQUIRE_ESM]: require() of ES Module .... ... Instead change the require of index.js in ... to a dynamic import() which is available in all CommonJS modules. The import code…
Yariv
  • 1,212
  • 10
  • 21
3
votes
1 answer

How to use nanoid without import

I am stuck with an issue, I have to generate a 6 digit alphanumeric CODE which should be unique and for that i am using nanoid, Now when i code this: const {nanoid} = require("nanoid"); const ID = nanoid(); I got error: const {nanoid} =…
3
votes
5 answers

How to install nanoid in nodejs?

I am currently trying to import and use nanoid in my (Firebase) nodejs project. I installed it with npm i nanoid and I tried to import it with import { nanoid } from 'nanoid' and import { nanoid } from…
Linus Grosser
  • 103
  • 1
  • 1
  • 8
2
votes
0 answers

How to write log has token trace per request

I user gopkg.in/natefinch/lumberjack.v2 to write log and compress file log. I config log like func Init() { file := &lumberjack.Logger{ Filename: "info" + ".log", MaxSize: 20, // mb MaxBackups: 5, Compress: …
htan
  • 79
  • 6
2
votes
1 answer

Nanoid library not working as a thingsboard resource

I need to generate a 10 character id for a project in Thingsboard, i'm facing a problem with the nanoid lib. I need to use the cdnjs so i've tried first with the 4.0 version (the index.browser.min.js one) and it's giving me this problem as soon as i…
1
vote
1 answer

Problem with generating random Id in react-native with Nanoid or UUID

I have a chat app, when I create for the first time a new chat I need an random Id to identify the chat, then, when I try to send the message I need that same id. I declare nanoId before the component declaration: import…
1
vote
0 answers

Using nanoid in Vue fails with ''Missing file extension cjs"

I want to use nanoid in my Vue project. I tried both: import nanoid from 'nanoid'; import { nanoid } from 'nanoid'; but webpack fails with Module Error (from ./node_modules/eslint-loader/index.js): error: Missing file extension "cjs" for "nanoid"…
Leos Literak
  • 8,805
  • 19
  • 81
  • 156
0
votes
0 answers

Unique ID for Sanity Studio's article

Folks. I did the random ID creation plugin but faced some difficulties. I am sharing it here, because somebody can advise me about a fix, and can be very useful for others. First install the dependencies with: npm i nanoid @sanity/ui Creating file:…
Maximi
  • 559
  • 5
  • 18
0
votes
0 answers

typeorm default function thorws duplicate value error on with batch insert

I have created default function for one column where i am generating nanoid using this package: https://www.npmjs.com/package/nanoid. @Column('public_id', { unique: true, default: () => `'${nanoid()}'` }) This is working fine while single insert…
Tushar Nikam
  • 594
  • 4
  • 13
0
votes
0 answers

Changing variable values when they become arguments inside a function in template literal

I never experienced this one, so I have been struggling it for 4 hours so far. Let's say we have a button inside template literal. deleting function is used for just…
0
votes
1 answer

Replacing hyphen by equal sign in Nano IDs in URLs, aka, extra equal signs in URLs - are they safe?

I am using Nano ID to generate unique strings to safely differentiate URLs automatically generated from product parameters, so where duplicates might occur. The order of parameters is strict (think…
marko-36
  • 1,309
  • 3
  • 23
  • 38
0
votes
2 answers

Cannot integrate third party tools with TectCafe Studio

I'm new to TestCafe and TypeScript. I was trying to integrate the NanoID module to TestCafe following this tutorial. But it shows an error saying Cannot find module 'nanoid' or its corresponding type declarations. (2307). But when I tried with uuid,…
1
2