Hi,
Im trying to use a NPM package with the following code:
import { Meteor } from ‘meteor/meteor’;
import * as five from ‘johnny-five’
Meteor.startup(function() {
var board = new five.Board();
var button;
board.on("ready", Meteor.bindEnvironment(function() {
button1 = new five.Button(2);
button2 = new five.Button(3);
button3 = new five.Button(4);
button4 = new five.Button(5);
board.repl.inject({
button1: button1,
button2: button2,
button3: button3,
button4: button4
});
button1.on("down", function() {
console.log("number 1 on vajutatud")
});
button1.on("up", function() {
console.log("number 1 on lahti lastud")
});
button2.on("down", function() {
console.log("number 2 on vajutatud")
});
button2.on("up", function() {
console.log("number 2 on lahti lastud")
});
button3.on("down", function() {
console.log("number 3 on vajutatud")
});
button3.on("up", function() {
console.log("number 3 on lahti lastud")
});
button4.on("down", function() {
console.log("number 4 on vajutatud")
});
button4.on("up", function() {
console.log("number 4 on lahti lastud")
});
}))
})
But I get some strange typeError:
W20160509-19:43:05.697(3)? (STDERR)
W20160509-19:43:05.697(3)? (STDERR) /Users/macbook/.meteor/packages/meteor-tool/.1.3.1.nne2tz++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:267
W20160509-19:43:05.697(3)? (STDERR) throw(ex);
W20160509-19:43:05.697(3)? (STDERR) ^
W20160509-19:43:05.700(3)? (STDERR) TypeError: Object [object Math] has no method 'log2'
W20160509-19:43:05.700(3)? (STDERR) at Object.Fn.bitsIn (/Users/macbook/kuldVillak/node_modules/johnny-five/lib/fn.js:234:26)
W20160509-19:43:05.700(3)? (STDERR) at Object.<anonymous> (/Users/macbook/kuldVillak/node_modules/johnny-five/lib/fn.js:240:14)
W20160509-19:43:05.700(3)? (STDERR) at Module._compile (module.js:456:26)
W20160509-19:43:05.701(3)? (STDERR) at Object.Module._extensions..js (module.js:474:10)
W20160509-19:43:05.701(3)? (STDERR) at Module.load (module.js:356:32)
W20160509-19:43:05.701(3)? (STDERR) at Function.Module._load (module.js:312:12)
W20160509-19:43:05.701(3)? (STDERR) at Module.require (module.js:364:17)
W20160509-19:43:05.701(3)? (STDERR) at require (module.js:380:17)
W20160509-19:43:05.701(3)? (STDERR) at Object.<anonymous> (/Users/macbook/kuldVillak/node_modules/johnny-five/lib/board.js:15:10)
W20160509-19:43:05.701(3)? (STDERR) at Module._compile (module.js:456:26)
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
Am I doing somethign wrong with the import of the NPM package or what can be the issue here?