Skip to content

Upgrading to v10

This is the migration guide for upgrading from v9 to v10.

TIP

v10 has not yet been released. This page contains a work-in-progress list of breaking changes in v10.

General Breaking Changes

Node v18 No Longer Supported

Support for Node.js v18 has been discontinued, as this version has reached its end-of-life. Faker.js v10 requires a minimum of Node.js v20.19.0, v22.13.0, or v24.0.0.

CommonJS Still Supported, but Check Your Node Version

Technically, Faker v10 is now an ESM-only package. However, the good news is that you can still use it from your CommonJS packages without code changes, thanks to the ESM Modules require feature in recent versions of Node.js.

If you are using Node 20, ensure you are using a sufficiently recent minor version—Node v20.19+ or Node v22.13+ is required.

ts
const { faker, fakerES } = require('@faker-js/faker'); // this still works

If your version of Node.js is too old, you may see an error like:

Uncaught:
Error [ERR_REQUIRE_ESM]: require() of ES Module <path>/faker/dist/index.js not supported.
Instead, change the require of index.js in null to a dynamic import(), which is available in all CommonJS modules.

Removal of Deprecated Code

A number of methods that were deprecated in v9 have been completely removed in v10. To prepare for the upgrade, it is recommended to first upgrade to the latest version of v9 (e.g., npm install --save-dev faker@9) and fix any deprecation warnings issued by your code.

Removed MethodReplacement / Notes
faker.address.*faker.location.*
faker.name.*faker.person.*
faker.internet.userNamefaker.internet.username

Some methods do not have exact replacements, so check your code carefully.

Removed MethodReplacement / Notes
faker.internet.colorfaker.color.rgb
faker.image.urlPlaceholderfaker.image.dataUri
faker.finance.maskedNumberSee #3201
faker.image.avatarLegacyfaker.image.avatar

Released under the MIT License.