0
votes

I am learning nativescript. I am trying to use faker to create some data with typescript.

Node version - 6.9.4
Faker - 3.1.0
typescript - 2.1.4

I got this error and haven't been able to run the app.

1 0x103841709 NativeScript::FFICallback::ffiClosureCallback(ffi_cif*, void*, void**, void*) 2 0x103eac01e ffi_closure_unix64_inner 3 0x103eac9d2 ffi_closure_unix64 4 0x104a92cd3 -[UIViewController view] 5 0x104968fb4 -[UIWindow addRootViewControllerViewIfPossible] 6 0x10496969d -[UIWindow _setHidden:forced:] 7 0x10497b180 -[UIWindow makeKeyAndVisible] 8 0x103eac82d ffi_call_unix64 9 0x117f966d0 file:///app/tns_modules/Faker/lib/locales/ja/index.js:4:21: JS ERROR Error: Could not find module './address'. Computed path '/Users/user/Library/Developer/CoreSimulator/Devices/CB21F7AD-A7B5-4D7D-96E2-218F3EDAEA1B/data/Containers/Bundle/Application/E503DADB-A0F5-49E6-A65B-A2F2072DB885/demo1.app/app/tns_modules/Faker/lib/locales/ja/address'.

1

1 Answers

0
votes

I have tested the library with a new NativeScript project and it works as expected. Here is what I have done, step by step:

npm i Faker --save

And afterwards:

var faker = require('Faker'); 
var randomName = faker.Name.findName();

export function navigatingTo(args: EventData) {
    console.log("randomName: " + randomName); // returns random name like Carmela Weimann
}

Sample application here