Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to require most modules #22

Open
JiCiT opened this issue Jun 1, 2015 · 2 comments
Open

Unable to require most modules #22

JiCiT opened this issue Jun 1, 2015 · 2 comments

Comments

@JiCiT
Copy link

JiCiT commented Jun 1, 2015

I'm having an issue that looks very similar to #18. Any pointers on how to resolve?

# plv8x -d 'postgres://jason:<password>@localhost:5432/platinum33' -l

microtime: 9414 bytes
json-stringify-safe: 5041 bytes
qs: 16192 bytes
plv8x: 1038096 bytes

SELECT |> 'require("qs").parse("foo=bar&baz=1")' AS qs;

WARNING: failed to load module fs: Error: Cannot find module "./lib/" @[module: index package: qs]
WARNING: failed to load module qs: Error: Cannot find module "./lib/" @[module: index package: qs]

ERROR: TypeError: Cannot call method 'parse' of undefined
DETAIL: undefined() LINE 0: (function(){return require("qs").parse("foo=bar&baz=1")})
********** Error **********

ERROR: TypeError: Cannot call method 'parse' of undefined
SQL state: XX000
Detail: undefined() LINE 0: (function(){return require("qs").parse("foo=bar&baz=1")})

SELECT |> 'require("util").log("test")';

WARNING: failed to load module fs: Error: Cannot find module "fs" @[module: lib/index package: plv8x]
WARNING: failed to load module util: Error: Cannot find module "util" @[module: lib/index package: plv8x]

ERROR: TypeError: Cannot call method 'log' of undefined
DETAIL: undefined() LINE 0: (function(){return require("util").log("test")})
********** Error **********

ERROR: TypeError: Cannot call method 'log' of undefined
SQL state: XX000
Detail: undefined() LINE 0: (function(){return require("util").log("test")})

SELECT |> 'require("microtime").log("now")';

WARNING: failed to load module fs: Error: Cannot find module "fs" @[module: lib/index package: plv8x]
ERROR: TypeError: Cannot call method 'log' of undefined
DETAIL: undefined() LINE 0: (function(){return require("microtime").log("now")})
********** Error **********

ERROR: TypeError: Cannot call method 'log' of undefined
SQL state: XX000
Detail: undefined() LINE 0: (function(){return require("microtime").log("now")})

However, this one seems to work for some reason. I'm not sure if maybe it's because I have the syntax wrong fro this one.

SELECT |> 'require("json-stringify-safe")({"monkey":{"bot":"cat"}})'

"{"monkey":{"bot":"cat"}}"

@JiCiT
Copy link
Author

JiCiT commented Jun 1, 2015

Sorry for the noise. I was running into trouble using the version from git where lsc wasn't running properly, so I wasn't winding up with everything that was required to run. I had tried using the version from npm and that's where I was getting the errors. I would be good to update the npm version if at all possible.

@JiCiT JiCiT closed this as completed Jun 1, 2015
@clkao
Copy link
Owner

clkao commented Jun 2, 2015

@JiCiT thanks, i'll reopen this for now until published version is working properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants