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

2

6

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.

Subminiature answered 28/1, 2022 at 11:6 Comment(0)
L
14

The faker package has been discontinued.

To resolve this, try doing the following:

npm install @faker-js/faker --save-dev
# or yarn 
yarn add @faker-js/faker -D

You can override the import to:

import { faker } from '@faker-js/faker';

Documentation @faker-js/faker

Leann answered 27/4, 2022 at 11:31 Comment(3)
thank you for your response. Actually, I have asked the same question from DevExpress and got the same answer and it resolved my question [supportcenter.devexpress.com/ticket/details/t1063835/….Subminiature
I'll mark your answer as correct for the use of any other person. Thank you againSubminiature
import { faker } from "@faker-js/faker";Trike
U
1

Faker package is discontinued and may not be used anymore.

Underbody answered 28/1, 2022 at 11:8 Comment(1)
Hi @omidh! I recently found out that still faker can be used as a third party too. Refer the below ticket. supportcenter.devexpress.com/ticket/details/t1063835/…Subminiature

© 2022 - 2024 — McMap. All rights reserved.