简体   繁体   English

找不到模块“faker”或其相应的类型声明。(2307)

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

I was trying to use 'faker' with TypeScript in TestCafe Studio.我试图在 TestCafe Studio 中将“faker”与 TypeScript 一起使用。 But I'm getting an error saying Cannot find module 'faker' or its corresponding type declarations.(2307)但是我收到一条错误消息,提示找不到模块“faker”或其相应的类型声明。(2307)

import * as faker from 'faker';

This is what I have tried in TestCafe.这是我在 TestCafe 中尝试过的。

The faker package has been discontinued. faker package已经停产。

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文档@faker-js/faker

Faker package is discontinued and may not be used anymore. Faker package 已停产,可能不再使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 TS2307:找不到模块或其对应的类型声明。 在 Github 操作 - error TS2307: Cannot find module or its corresponding type declarations. on Github Actions 找不到模块 './components/Table/Table' 或其对应的类型声明。 ts(2307) - Cannot find module './components/Table/Table' or its corresponding type declarations. ts(2307) 错误 TS2307:找不到模块“路径”或其相应的类型声明。 尝试使用 Knex 在 heroku 应用程序中迁移时 - error TS2307: Cannot find module 'path' or its corresponding type declarations. when trying to migrate in heroku app with Knex 如何修复/忽略此控制台错误“TS2307:找不到模块‘@components/common/ButtonBlock’或其相应的类型声明。” - How fix/ignore this console error “TS2307: Cannot find module '@components/common/ButtonBlock' or its corresponding type declarations.” TS2307:找不到模块“@/*”或其对应的类型声明 - TS2307: Cannot find module '@/*' or its corresponding type declarations 如何解决找不到找不到模块'../home/featuredRooms'或其对应的类型声明。? - how to solve cannot find Cannot find module '../home/featuredRooms' or its corresponding type declarations.? Vercel cli 构建失败并出现错误“类型错误:找不到模块‘Formik’或其相应的类型声明。” - Vercel cli build fails with error "Type error: Cannot find module 'Formik' or its corresponding type declarations." 业力,Webpack & Typescript:TS2307:找不到模块“log4js”或其相应的类型声明 - Karma, Webpack & Typescript: TS2307: Cannot find module 'log4js' or its corresponding type declarations 使用 SvelteKit 从“$lib”导入时找不到模块 [...] 或其相应的类型声明 (js2307) - Cannot find module [...] or its corresponding type declarations (js2307) when importing from "$lib" with SvelteKit 错误 TS2307:找不到模块“fs”或其相应的类型声明 - error TS2307: Cannot find module 'fs' or its corresponding type declarations
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM