Right now I have:
"faker": "^5.5.3",
"@types/faker": "^5.5.3",
in my packages.json. I'm using 5.5.3 because there's another dependency in the project (codecept) that's locked to the older version.
The original faker project at https://www.npmjs.com/package/faker seems to have been abandoned. It has a joke version number, no description, etc.
I'd like to use the project that is actively maintained at https://www.npmjs.com/package/@faker-js/faker
But when I try:
- in my packages.json:
"@faker-js/faker": "^5.5.3"
- importing it with:
import { faker } from '@faker-js/faker';
(per faker-js documentation) - call it like
faker.datatype.number(100);
I get:
Cannot read properties of undefined (reading 'datatype')
TypeError: Cannot read properties of undefined (reading 'datatype')
Weirdly, this same code works on a coworker's laptop.
What am I doing wrong? I've tried doing stuff like blowing away node_modules
and starting fresh, and running npm install
, but no luck.