'Cannot find module 'faker' or its corresponding type declarations.(2307)
I was trying to use 'faker' with TypeScript in TestCafe Studio. But I'm getting an error saying Cannot find module 'faker' or its corresponding type declarations.(2307)
import * as faker from 'faker';
This is what I have tried in TestCafe.
Solution 1:[1]
The faker package has been discontinued
To resolve this try doing the following:
npm
npm install @faker-js/faker --save-dev
or yarn
yarn add @faker-js/faker --dev
You can override the import to:
import faker from "@faker-js/faker";
Documentation @faker-js/faker
Solution 2:[2]
Faker package is discontinued and may not be used anymore.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | omidh |