Meteor: Referenceerror: Require Is Not Defined
I have installed meteorhacks:npm and defined apn in packages.json {'apn': '1.6.2'}. However, I get an error ReferenceError: require is not defined when I run the following code: va
Solution 1:
Use Meteor.npmRequire
insted of Npm.require
for packages loaded via meteorhacks:npm. For example:
var apn = Meteor.npmRequire('apn');
var path = Npm.require('path');
Also note that requiring an npm package will only work on the server, so make sure that code is in your /server
directory or guarded by Meteor.isServer
.
Post a Comment for "Meteor: Referenceerror: Require Is Not Defined"