tjwebb / pg-json-schema-export

Export Postgres schemas as JSON ( tables, constraints, sequences)
https://www.npmjs.org/package/pg-json-schema-export
MIT License
38 stars 18 forks source link

Error: ENOENT, no such file or directory './sql/views.sql' #5

Closed charyorde closed 9 years ago

charyorde commented 9 years ago

Hi,

Node couldn't load views.sql file within the sql directory.

Here's the console error log below:

bash-3.2$ node mgrt_pg_to_mongo.js

fs.js:427
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory './sql/views.sql'
    at Object.fs.openSync (fs.js:427:18)
    at Object.fs.readFileSync (fs.js:284:15)
    at Object.<anonymous> (/Users/charyorde/projects/nodescripts/node_modules/pg-json-schema-export/index.js:7:25)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/charyorde/projects/nodescripts/mgrt_pg_to_mongo.js:1:84)

Env:

charyorde commented 9 years ago

Same error after upgrade: to node v0.10.33 and npm v2.1.11

charyorde commented 9 years ago

Executing the test, gives similar errors:

1) pg-json-schema-export #toJSON should return an object:
     Error: ENOENT, no such file or directory 'build/postbooks_demo_460.json'
      at Object.fs.openSync (fs.js:438:18)
      at Object.fs.writeFileSync (fs.js:977:15)
      at Context.<anonymous> (/Users/charyorde/projects/nodescripts/node_modules/pg-json-schema-export/test.js:29:10)
      at callFn (/usr/local/lib/node_modules/mocha/lib/runnable.js:250:21)
      at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:243:7)
      at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:373:10)
      at /usr/local/lib/node_modules/mocha/lib/runner.js:451:12
      at next (/usr/local/lib/node_modules/mocha/lib/runner.js:298:14)
      at /usr/local/lib/node_modules/mocha/lib/runner.js:308:7
      at next (/usr/local/lib/node_modules/mocha/lib/runner.js:246:23)
      at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:275:5)
      at processImmediate [as _immediateCallback] (timers.js:345:15)
tjwebb commented 9 years ago

Error: ENOENT, no such file or directory './sql/views.sql'

I'm not sure how you'd be missing this file. It's right here: https://github.com/tjwebb/pg-json-schema-export/blob/master/sql/views.sql

The build also passes: https://travis-ci.org/tjwebb/pg-json-schema-export/jobs/33048371. So I'm not quite sure what's going on.

tjwebb commented 9 years ago

any update?

charyorde commented 9 years ago

I did a number of workarounds to get this working. I can't remember much of it any longer though. But one of it should be installing locally instead of globally.

tjwebb commented 9 years ago

Yea... installing npm packages globally usually isn't going to work. It'd be nice in the future if you'd report the issues instead of silently hacking together workarounds that no one else can use.

tjwebb commented 9 years ago

Like I said, in the future, file issues before implementing random hacks to make stuff work. On Jan 27, 2015 8:26 AM, "charyorde" notifications@github.com wrote:

Closed #5 https://github.com/tjwebb/pg-json-schema-export/issues/5.

— Reply to this email directly or view it on GitHub https://github.com/tjwebb/pg-json-schema-export/issues/5#event-225347661 .