How to use node wrapper packages?

I want to add an irc client to my app with this package:
https://atmospherejs.com/ahref/irc

it wrapps this node-irc package https://github.com/martynsmith/node-irc

If I add the node example code:
var irc = require('irc'); var client = new irc.Client('irc.yourserver.com', 'myNick', { channels: ['#channel'], });

I get the error ReferenceError: require is not defined.

I also tried the npm-container package to use require which results in either in
"Meteor.npmRequire is not a function" or
"Meteor.require is not a function"

Can anyone give me a hint on how to use this wrapper properly?

node-irc meteor wrapper export ‘irc’ global: https://github.com/rfox90/meteor-irc/blob/master/package.js

Then your code become:

//var irc = require('irc');
var client = new irc.Client('irc.yourserver.com', 'myNick', { channels: ['#channel']});

Then I get “irc is not defined” and adding it to my controller providers results in “Error: [$injector:unpr] Unknown provider: ircProvider <- irc <- AppCtrl”

can you post a public github repository?

do you add package?

meteor add ahref:irc

Yes I’ve added it :smile:

This is my controller, maybe I’m missing something:

`angular
.module(‘App-Platform’)
.controller(‘AppCtrl’, [’$scope’, ‘$timeout’, ‘$mdSidenav’, ‘$mdUtil’, ‘$log’, ‘$meteor’, ‘$stateParams’, ‘$state’, ‘$rootScope’, ‘$mdDialog’,
function ($scope, $timeout, $mdSidenav, $mdUtil, $log, $meteor, $stateParams, $state, $rootScope, $mdDialog) {

  var client = irc.Client('test.test.com', 'myNick', {
    port: 6601,
    channels: ['#welcome']
  });

  client.addListener('message', function (from, to, message) {
    console.log(from + ' => ' + to + ': ' + message);
  });


}]);`

api.export(‘irc’,‘server’);

Means I can only use irc on serverside… I am an idiot :smiley: Thanks anyway