javascript - Using an NPM package with dependencies in Meteor -
i'm trying use npm package in meteor project have problems getting work.
the module i’m trying use steam package. i’ve added meteorhacks:npm package meteor , changed packages.json file to:
{ "steam": "0.6.8", "adm-zip": "0.4.7", "buffer-crc32": "0.2.5", "bytebuffer": "3.5.4", "bufferview": "1.0.1", "long": "2.2.3", "protobufjs": "4.0.0-b2", "ascli": "1.0.0", "optjs": "3.2.1-boom", "colour": "0.7.1" }
(to clarify above, it’s steam package dependencies , dependencies of dependencies)
now i’ve tried use package in meteor app code located in -/server/steambot/steambot.js
var steam = meteor.npmrequire('steam'); var bot = new steam.steamclient(); bot.logon({ // (fake credentials) accountname: 'a', password: '123456789', authcode: 'aaa55', shasentryfile: 'aaa' });
i hoped easy errors started.
var cryptedsesskey = require('crypto').publicencrypt(fs.readfilesync(__dirna typeerror: object # has no method 'publicencrypt'
i figured out it’s require()
function of steam , dependencie packages that’s giving me these errors. if replace require()
meteor.npmrequire()
go the next require()
function in 1 of npm packages.
is there way fix issue without changing every require() function meteor.npmrequire()
?
and if should best approach?
i'm quite new npm , meteor world, kind of workflow way should doing and/or there improvements make or keep in mind?
update: of july 2016 meteor 1.4 uses node 4.4.7, support stream npm package (requires 4.1.1+)
the steam npm plugin not work meteor.
the npm package page (https://www.npmjs.com/package/steam) states:
note: node.js v0.12 , io.js v1.4 supported.
meteor using older version of nodejs. e.g. meteor v1.0.4 (march 17, 2015) uses v0.10.36
meteor has short release cycles, doubt node v0.12 supported anytime considering meteor v0.8.1.1 (may 1, 2014) using node v0.10.26.
Comments
Post a Comment