Questions tagged [node-uuid]

A JavaScript library for generating RFC4122 UUIDs. It is compatible with Node.js and browsers.

https://www.npmjs.com/package/uuid

Examples

// Generate a v4 (random) id 
import { v4 as uuidv4 } from 'uuid';
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'

// Generate a v1 (time-based) id 
import { v1 as uuidv1 } from 'uuid';
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d'
15 questions
11
votes
2 answers

Getting strange error using UUID npm module. What am I doing wrong?

Getting "Error: Package exports for 'D:\test\node_modules\uuid' do not define a '.' subpath" all the time when I require it. OS - Windows 10 Pro Node version - v13.1.0 NPM version - 6.14.4 I created a project from scratch and run npm init -y to…
through.a.haze
  • 516
  • 1
  • 6
  • 15
10
votes
1 answer

Jest: How to globally mock node-uuid (or any other imported module)

Recently migrated from mocha to jest and I'm running into an issue. I have lots of warnings in my tests: [SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random() Now, adding the following line to each file fixes the issue, but…
Justin Schrader
  • 201
  • 1
  • 3
  • 7
7
votes
4 answers

Can't use uuid module when running tests with Jest

I have a very simple Node.js (12.16.3) application that uses Express 4.17.1. I'm trying to use Jest 26.0.1 to run the test suite, but the same is failing due to some issue with the uuid module (version 8.1.0) used across the entire…
x80486
  • 6,627
  • 5
  • 52
  • 111
4
votes
3 answers

Sortable UUID v1 for multi-platform application

We are looking for a solution to generate a unique id for messages/signals that are exchanged between clients on the Web, iOS, and Android and later persisted on the backend. Solution have to be standardized available on multiple…
Marcel Mandatory
  • 1,447
  • 13
  • 25
2
votes
1 answer

Is it better to use a 128-bit long (uuid) or a 7-bit long (shortid) unique ID generator in Node?

I'm currently using uuid npm package to generate unique IDs for the elements of my graph database in my node.js app. It generates RFC-compliant 128-bit long IDs, like 6e228580-1cb5-11e8-8271-891867c15336 I'm currently thinking to shift to shortid…
Aerodynamika
  • 7,883
  • 16
  • 78
  • 137
1
vote
1 answer

Python equivalent library/module for node-machine-id?

I'm looking for python equivalent library/module for node-machine-id I want to uniquely identify each desktop/device & get that UUID & send to DB. I'm able to achieve this particular thing in javascript with below code import pkg from…
1
vote
1 answer

Generating a UUID by limiting the characters' length

I am using the node js library uuid-int to generate unique id. const id = 0; const generator = UUID(id); const uuid = generator.uuid(); // e.g. 3425779734788360 However I want to reduce the length of the number while making sure it is still…
John doe
  • 3,680
  • 7
  • 31
  • 65
1
vote
4 answers

Unable to resolve module util from node_modules\uuidv4\build\lib\uuidv4.js

There are some questions with this title but I have. tried every solution in them but I'm unable to resolve this. I've just started learning React-Native and I'm getting this error: I've tried the steps mentioned in this red box. I've tried…
Chaudhry Talha
  • 7,231
  • 11
  • 67
  • 116
1
vote
1 answer

Deprecated Warning: Deep requiring like const uuidv5 = require('uuid/v5'); is deprecated as of uuid@7.x in node js

how to solve this issue? (node:2144) DeprecationWarning: Deep requiring like const uuidv5 = require('uuid/v5'); is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when…
John
  • 55
  • 1
  • 10
1
vote
1 answer

Are Node-UUIDs secure?

On the documentation it says: "Uses cryptographically-strong random number APIs (when available)" I imagine that this means that there are situations where the unsecure Math.random is used? Also as a follow up what version is most recommended for…
Vangogh500
  • 939
  • 1
  • 7
  • 17
1
vote
2 answers

Including node-uuid package in Ionic 2 application

I'm building an Ionic 2 (RC0) application and I'm trying to use node-uuid by following the official documentation. I've done: $ npm install --save node-uuid $ npm install --save @types/node-uuid node-uuid seems to be using the default export…
Niel de Wet
  • 7,806
  • 9
  • 63
  • 100
0
votes
1 answer

Generate an array of UUID's in Javascript

Using a module such as uuid how could I generate the following structure. [ 'd9baea4e-2436-4481-accb-7c2fe835039e', '60152666-8c2c-4d33-a5c8-da1dda106c5d', 'c4eaa558-83cc-4b94-9aff-1aefdc204794', …
stackunderflow
  • 1,644
  • 6
  • 24
  • 40
0
votes
0 answers

node-uuid giving duplicate key errror

I have a method for inserting a task in the mongoDB database and a function to display all the tasks. createTask(title, description) { if (!title) { return Promise.reject("you must provide a name for your Task"); } if (!description) { …
Arjun Dass
  • 11
  • 3
0
votes
1 answer

Generating Unique IDs on Node.js for a Express web application

Ive come across two possible libraries node-uuid (https://www.npmjs.com/package/node-uuid) and cuid (http://usecuid.org/). Both of these from what i can see generate good collision free unique ids. However, there is the odd situation where there may…
nixgadget
  • 6,983
  • 16
  • 70
  • 103
0
votes
1 answer

uuid.js not using crypto.getRandomValues when built with browserify

I ran into a problem using the node-uuid library. I was building with browserify, and I found that despite running in a modern browser that supported the crypto API, it wasn't actually using the crypto.getRandomValues method to generate randomness.
1800 INFORMATION
  • 131,367
  • 29
  • 160
  • 239