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

WARNING: failed to load module qs: SyntaxError: Unexpected token } #23

Closed
bendiy opened this issue Jun 23, 2015 · 2 comments
Closed

WARNING: failed to load module qs: SyntaxError: Unexpected token } #23

bendiy opened this issue Jun 23, 2015 · 2 comments

Comments

@bendiy
Copy link

bendiy commented Jun 23, 2015

I'm having an issue similar to #18 and #22.

$ plv8x -d testplv8x -l
plv8x: 392.33 kB
qs: 467 B
LiveScript: 467 B

Running the test queries:

testplv8x=# SELECT |> 'require("qs").parse("foo=bar&baz=1")';
WARNING:  failed to load module qs: SyntaxError: Unexpected token }
WARNING:  SyntaxError: Unexpected token }
    at plv8x.require (boot:27:23)
    at eval (eval at <anonymous> (json_eval:5:25), <anonymous>:1:20)
    at json_eval:5:48
    at null.<anonymous> (json_eval:6:8)
ERROR:  TypeError: Cannot call method 'parse' of undefined
DETAIL:  undefined() LINE 0: (function(){return require("qs").parse("foo=bar&baz=1")})
testplv8x=# SELECT qs~>'@foo' AS foo FROM  (SELECT ~>'require("qs").parse("foo=bar&baz=1")' AS qs) a;
WARNING:  failed to load module LiveScript: SyntaxError: Unexpected token }
WARNING:  SyntaxError: Unexpected token }
    at plv8x.require (boot:27:23)
    at compileLivescript (boot:83:10)
    at cls (boot:51:38)
    at Object.xpressionToBody (boot:57:12)
    at json_eval_ls:5:25
    at null.<anonymous> (json_eval_ls:6
ERROR:  TypeError: Cannot call method 'compile' of undefined
DETAIL:  boot() LINE 82:   return require('LiveScript').compile(expression, {

My Postgres and plv8 versions:

testplv8x=# SELECT version();
                                               version
------------------------------------------------------------------------------------------------------
 PostgreSQL 9.3.5 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit
(1 row)

testplv8x=# DO $$ plv8.elog(WARNING, 'plv8.version = ', plv8.version); $$ LANGUAGE plv8;
WARNING:  plv8.version =  1.4.0
DO

Using the latest plv8x:

~/plv8x$ git log
commit 3c19d57adfa5050c27715699d2369d2c441c817d
Author: Chia-liang Kao <[email protected]>
Date:   Thu Feb 19 01:30:27 2015 +0800

    quick start with docker-based plv8js-enabled pg

commit 0f5ee2f982029bb2c0c0a27fe38d67ad7d8481fb
Author: Chia-liang Kao <[email protected]>
Date:   Wed Feb 18 23:55:41 2015 +0800

    modernize ls-based bin
@bendiy
Copy link
Author

bendiy commented Jun 24, 2015

It doesn't look like the npm packages are being installed correctly. Here's a backup of my code table:

INSERT INTO code (name, code, load_seq, updated) VALUES ('qs', '(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module ''"+o+"''");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({},{},[])(undefined)
});', NULL, '2015-06-23 18:41:05');
INSERT INTO code (name, code, load_seq, updated) VALUES ('LiveScript', '(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module ''"+o+"''");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({},{},[])(undefined)
});', NULL, '2015-06-23 18:46:05');

@bendiy
Copy link
Author

bendiy commented Jun 24, 2015

Found the root cause in #24. Closing this now that I have a work around.

@bendiy bendiy closed this as completed Jun 24, 2015
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

1 participant