Cannot find module 'faker' or its corresponding type declarations.(2307)

Viewed 1545

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.

2 Answers

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

Faker package is discontinued and may not be used anymore.

Related