Search code examples
meteormeteoriteyelp

Meteor.js Package: Npm.require cannot find module


I'm getting an error in a package I've created called yelp-o-auth. I'm using Meteor version 0.8.3

The error is

errorError: Cannot find module 'yelp'

This is my code requiring it in yelp-o-auth.js

var Yelp = Npm.require("yelp").createClient(auth);

This is in package.js

Npm.depends({
    'yelp': '0.1.1'
});

When I run

npm view yelp

it returns

name: 'yelp',
  description: 'Library for interfacing with Yelp\'s API v2.0.',
  'dist-tags': { latest: '0.1.1' },
  versions: [ '0.1.0', '0.1.1' ],
...

Solution

  • Within packages variable scoping still applies so you have to remove the var keyword:

    yelp = Npm.require("yelp").createClient(auth);

    Also, these two related threads may help.