The error happens because the original faker
package on npm is no longer maintained and is essentially empty.
To fix this, you need to switch to the community-maintained fork @faker-js/faker
.
First, remove the old package:
import { faker } from "@faker-js/faker";
console.log(faker.commerce.productName());