question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module 'uuid/v4'

See original GitHub issue

Hi, I install uuid module on my Windows 10 64bit with WebStorm and NodeJS 8.8.1 but when I require the module I get this error: error: uncaughtException: Cannot find module 'uuid/v4'

Any idea?

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

56reactions
corymcdonaldcommented, May 14, 2020

Just ran into this issue on my computer, it was because I was using the newer version of the library than my code was written for.

The original code was

const uuidV4 = require('uuid/v4')

Newer versions of this library requires it to be

const { v4: uuidV4 } = require('uuid');

Hope this helps anyone else searching in the future 👍

5reactions
broofacommented, May 24, 2020

If code size is a primary consideration for people, there are options:

  1. Stick with uuid@3.4 and the deep-import syntax
  2. Bite the bullet and convert to ES6 imports and a packager that does tree-shaking. (Will yield benefits beyond just pruning uuid code!)
  3. Use a “one-liner” implementation such as https://stackoverflow.com/a/2117523/109538. (Not actually recommending this, but if code footprint is paramount… well… 😆)
Read more comments on GitHub >

github_iconTop Results From Across the Web

NPM: Cannot find module 'uuid' - Stack Overflow
I have this message when i try to use npm: > $ npm module.js:472 throw ...
Read more >
uuidv4 - npm
Start using uuidv4 in your project by running `npm i uuidv4`. ... This module will be deprecated in the future in favour of...
Read more >
Module not found: Can't resolve 'uuid/v4' - Super User
Install uuid library via node package manager i.e. npm npm install uuid. Then import uuidv4 from uuid library
Read more >
Cannot find module 'uuid' error | bobbyhadz
To solve the error "Cannot find module 'uuid'", make sure to install the uuid package by opening your terminal in your project's root...
Read more >
Cannot find module 'uuid' error [Solved] - Reactgo
The “Cannot find module 'uuid'” error occurs due to one of the following ... import { v4 as uuidv4 } from 'uuid'; console.log(uuidv4()); ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found