I am trying to user Faker.js with Meteorite. I have added this package:
https://atmosphere.meteor.com/package/Faker.js
I am trying to add fake users on server startup:
Meteor.startup(function () {
// code to run on server at startup
// add 100 fake tips and 10 fake articles and 50 fake users
for (var i=0; i<50; i++) {
// Accounts.createUser(Faker.Internet.userName(), Faker.Internet.email(), "1234");
}
});
but I get an error:
ReferenceError: Faker is not defined
Not sure how to fix this...
I'd recommend installing the
npm
package, and adding Faker as an NPM module. It's quite simple:mrt add npm
packages.json
file in your project root, and add{ "Faker": "0.5.11" }
mrt update
Faker = Meteor.require('Faker');
Now you can use it like normal, e.g.
Faker.Internet.email()