hoegaarden / pgpass

node.js module for reading ~/.pgpass
3 stars 14 forks source link

meteor js integration #2

Closed stevenbarragan closed 10 years ago

stevenbarragan commented 10 years ago

Hi guys,

I'm new in node js and I'm trying to integrate node-postgres package, which requires pgpass in my meteor application but I'm getting some errors. Could somebody please help me?

W20140324-12:57:58.598(-6)? (STDERR) /Users/crowdint/.meteor/tools/8e197f29c5/lib/node_modules/fibers/future.js:173
W20140324-12:57:58.598(-6)? (STDERR) throw(ex);
W20140324-12:57:58.599(-6)? (STDERR)      ^
W20140324-12:57:58.602(-6)? (STDERR) ReferenceError: require is not defined
W20140324-12:57:58.602(-6)? (STDERR)     at app/node_modules/pg/node_modules/pgpass/lib/helper.js:3:12
W20140324-12:57:58.602(-6)? (STDERR)     at app/node_modules/pg/node_modules/pgpass/lib/helper.js:232:3
W20140324-12:57:58.603(-6)? (STDERR)     at /Users/crowdint/projects/kardex/.meteor/local/build/programs/server/boot.js:155:10
W20140324-12:57:58.603(-6)? (STDERR)     at Array.forEach (native)
W20140324-12:57:58.604(-6)? (STDERR)     at Function._.each._.forEach (/Users/crowdint/.meteor/tools/8e197f29c5/lib/node_modules/underscore/underscore.js:79:11)
W20140324-12:57:58.604(-6)? (STDERR)     at /Users/crowdint/projects/kardex/.meteor/local/build/programs/server/boot.js:82:5

The file:

var path = require('path')
  , Stream = require('stream').Stream
  , Split = require('split')
  , util = require('until')

I did that:

var path = Npm.require('path')
  , Stream = Npm.require('stream').Stream
  , Split = Npm.require('split')
  , util = Npm.require('util')

But I'm still getting errors

W20140324-13:00:53.582(-6)? (STDERR) /Users/crowdint/.meteor/tools/8e197f29c5/lib/node_modules/fibers/future.js:173
W20140324-13:00:53.583(-6)? (STDERR) throw(ex);
W20140324-13:00:53.583(-6)? (STDERR)      ^
W20140324-13:00:53.587(-6)? (STDERR) ReferenceError: module is not defined
W20140324-13:00:53.587(-6)? (STDERR)     at app/node_modules/pg/node_modules/pgpass/lib/helper.js:40:23
W20140324-13:00:53.588(-6)? (STDERR)     at app/node_modules/pg/node_modules/pgpass/lib/helper.js:232:3
W20140324-13:00:53.588(-6)? (STDERR)     at /Users/crowdint/projects/kardex/.meteor/local/build/programs/server/boot.js:155:10
W20140324-13:00:53.588(-6)? (STDERR)     at Array.forEach (native)
W20140324-13:00:53.588(-6)? (STDERR)     at Function._.each._.forEach (/Users/crowdint/.meteor/tools/8e197f29c5/lib/node_modules/underscore/underscore.js:79:11)
W20140324-13:00:53.589(-6)? (STDERR)     at /Users/crowdint/projects/kardex/.meteor/local/build/programs/server/boot.js:82:5

Js File:

Object.defineProperty(module.exports, 'isWin', {
    get : function() {
        return isWin;
    } ,
    set : function(val) {
        isWin = val;
    }
});

I wonder where module is being defined, and if the first fix it's OK. Could some body help me with that? I'll appreciate it.

hoegaarden commented 10 years ago

Hi.

First of all: I have no idea about meteorjs; so I can't answer your meteor related questions.

I wonder where module is being defined

module comes from node.js itself and is part of the package system.

If you could show your application, perhaps I (or someone with more meteor know-how) could take a look very quick ...

hoegaarden commented 10 years ago

Any news on this issue?

stevenbarragan commented 10 years ago

Yea, sorry, my bad. I was trying to do the integration in the wrong way.

Thanks for your help.

christianbundy commented 10 years ago

@stevenbarragan You can solve the "ReferenceError: module is not defined" error with my Meteor package exports – it replicates Node's module.exports so that you can integrate Node code into your application.

stevenbarragan commented 10 years ago

Thanks @christianbundy, I'll try it.