igorklopov / enclose

Compile your Node.js project into an executable
http://enclosejs.com
Other
936 stars 43 forks source link

Issue with knex.js #96

Closed arnaudchenyensu closed 7 years ago

arnaudchenyensu commented 8 years ago

Hi,

I'm currently working with the package knex.js, but when running the executable of my app (Linux machine) I got this error:

Knex:warning - Pool2 - Error: ResourceRequest aborted: Knex: Timeout acquiring a connection.
{ [Error: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?]
  timeoutStack: 'TimeoutError: operation timed out\n    at console.+/+t+h+e+b+o+x+/+u+s+r+/+l+o+c+a+l+/+a+p+p+/+n+o+d+e+_+m+o+d+u+l+e+s+/+b+l+u+e+b+i+r+d+/+j+s+/+r+e+l+e+a+s+e+/+t+i+m+e+r+s+.+j+s.module.exports.afterTimeout (e:0)\n    at timeoutTimeout [as _onTimeout] (e:0)\n    at Timer.listOnTimeout (timers.js:92:15)',
  sql: undefined,
  bindings: undefined }

But my app is working perfectly fine when using node index.js.

Update

Here the errors I got when compiling:

/usr/local/app/node_modules/knex/lib/index.js
  warning  Cannot resolve '"./dialects/" + <unknown OR> + "/index.js"'
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option

/usr/local/app/node_modules/knex/lib/migrate/index.js
  warning  Cannot resolve '_path2.default.join(this._absoluteConfigDir(), name)'
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option

/usr/local/app/node_modules/knex/lib/migrate/index.js
  warning  Cannot resolve 'directory + "/" + name'
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option

/usr/local/app/node_modules/knex/lib/seed/index.js
  warning  Cannot resolve '_path2.default.join(this._absoluteConfigDir(), name)'
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option

/usr/local/app/node_modules/knex/lib/seed/index.js
  warning  Cannot resolve 'name'
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option

Is there an easy way to fix those errors without modifying knex.js code?

igorklopov commented 8 years ago

If you use evaluation version, then you may probably have this issue. Evaluation version has network-related limitations. Your application will be not able to use network after some time passes. Please ignore this problem while using evaluation version.

arnaudchenyensu commented 8 years ago

I was not using the evaluation version but for some reason now I got this error when I launch the app:

undefined:0

Error: Cannot find module './dialects/postgres/index.js'
    at Error (native)
    at P (e:0)
    at f (e:0)
    at Knex (e:0)
    at Object.console.+/+t+h+e+b+o+x+/+u+s+r+/+l+o+c+a+l+/app/+m+o+d+e+l+s+/+u+t+i+l+s+.+j+s.dev (e:0)
    at r (e:0)
    at P (e:0)
    at f (e:0)
    at Object.console.+/+t+h+e+b+o+x+/+u+s+r+/+l+o+c+a+l+app/+m+o+d+e+l+s+/+u+s+e+r+.+j+s.dev (e:0)
    at r (e:0)
    at P (e:0)
    at f (e:0)
    at Object.console.+/+t+h+e+b+o+x+/+u+s+r+/+l+o+c+a+l+/+app/+a+u+t+h+.+j+s.dev (e:0)
    at r (e:0)
    at P (e:0)
    at f (e:0)
arnaudchenyensu commented 8 years ago

I solved my issue by installing the package pg-query-stream

npm install pg-query-stream

I then created a config file for enclose:

module.exports = {
    scripts: "./node_modules/knex/lib/dialects/postgres/index.js"
};

And then run enclose with the option -c config.js. Note: config.js can only have enclosejs options (you can't use a global config.js with the config of your app AND enclosejs).

Also, I think it should be interesting to indicate the option -c in the wiki under the section Explicit packaging. Actually, I don't even know where to find enclosejs options except by running enclose.

igorklopov commented 8 years ago

I have made some adjustments for knex in 2.1.0. Please reinstall enclose and try again.

igorklopov commented 7 years ago

Dear users of EncloseJS! I highly encourage you to switch to https://github.com/zeit/pkg It is rewritten successor of EncloseJS. It is open source, and all improvements will go there. Please check if pkg has your issue unresolved, and if it is true, reopen your issue there: https://github.com/zeit/pkg/issues