Module not found: Error: Package path ./v4 is not exported from package

Viewed 1068

I was building a react project but when I tried to run it. It showed the following error:

Module not found: Error: Package path ./v4 is not exported from package
....\node_modules\uuid (see exports field in ....\node_modules\uuid\package.json)

I imported using the following code:

import uuidv4 from 'uuid/v4';
1 Answers

Looks like an import issue in uuid. Try updating the import statement as:

import { v4 as uuidv4 } from 'uuid';
Related