Skip to content
On this page

Upgrading to v7

This is the migration guide for upgrading from v6 to v7.

INFO

Not the version you are looking for?

Node 12 no longer supported

You need at least Node 14 to use Faker.

Default export removed

If you were previously importing faker like this:

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

You must instead use:

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

Deprecated methods changed

Several methods were renamed or moved:

Old methodNew alternative
faker.random.numberfaker.datatype.number
faker.random.floatfaker.datatype.float
faker.random.arrayElementfaker.helpers.arrayElement
faker.random.arrayElementsfaker.helpers.arrayElements
faker.random.objectElementfaker.helpers.objectKey
faker.helpers.objectValue
faker.random.uuidfaker.datatype.uuid
faker.random.booleanfaker.datatype.boolean
faker.random.imagefaker.image.image
faker.random.hexaDecimalfaker.datatype.hexadecimal
faker.helpers.randomizefaker.helpers.arrayElement
faker.datatype.hexaDecimalfaker.datatype.hexadecimal
faker.name.titlefaker.name.jobTitle

Deprecated methods removed

Some methods were removed without a direct alternative. If you are using any of these methods you should build an object containing the specific properties you need.

Removed method
faker.helpers.createCard
faker.helpers.contextualCard
faker.helpers.userCard
faker.time
faker.helpers.createTransaction

Released under the MIT License.