BlinkTagInc / gtfs-to-html

Build human readable transit timetables as HTML or PDF from GTFS.
https://gtfstohtml.com
MIT License
183 stars 56 forks source link

MongooseError #98

Closed mzzntn closed 4 years ago

mzzntn commented 4 years ago

Hi, I'm trying to built gtfs-to-html through npm on an Elementary OS (Ubuntu 18.4) machine, but every time I try to configure the path with:

gtfs-to-html --configPath /home/**myuser**/Documents/config.json

I receive the following error

Error: MongooseError: Theuriparameter toopenUri()must be a string, got "undefined". Make sure the first parameter tomongoose.connect()ormongoose.createConnection()is a string. (node:15527) UnhandledPromiseRejectionWarning: MongooseError: Theuriparameter toopenUri()must be a string, got "undefined". Make sure the first parameter tomongoose.connect()ormongoose.createConnection()is a string. at new MongooseError (/usr/local/lib/node_modules/gtfs-to-html/node_modules/mongoose/lib/error/mongooseError.js:10:11) at NativeConnection.Connection.openUri (/usr/local/lib/node_modules/gtfs-to-html/node_modules/mongoose/lib/connection.js:579:11) at Mongoose.connect (/usr/local/lib/node_modules/gtfs-to-html/node_modules/mongoose/lib/index.js:333:15) at getConfig.then (/usr/local/lib/node_modules/gtfs-to-html/bin/gtfs-to-html.js:66:14) at <anonymous> (node:15527) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:15527) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

brendannee commented 4 years ago

Try updating to the latest version of GTFS-to-HTML 1.2.1 which no longer uses mongodb in favor of SQLite.

mzzntn commented 4 years ago

Hi Brendan I restarted from zero Edit. with an Ubuntu 20.4 machine


sudo npm install gtfs-to-html -g

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
/usr/local/bin/gtfs-to-html -> /usr/local/lib/node_modules/gtfs-to-html/bin/gtfs-to-html.js

> sqlite3@5.0.0 install /usr/local/lib/node_modules/gtfs-to-html/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

then

gtfs-to-html

internal/modules/cjs/loader.js:638
    throw err;
    ^

  Error: Cannot find module '/usr/local/lib/node_modules/gtfs-to-html/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.  node'

  - loader.js:636 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:636:15

  - loader.js:562 Function.Module._load
    internal/modules/cjs/loader.js:562:25

  - loader.js:692 Module.require
    internal/modules/cjs/loader.js:692:17

  - helpers.js:25 require
    internal/modules/cjs/helpers.js:25:18

  - sqlite3-binding.js:4 Object.<anonymous>
    [lib]/[gtfs-to-html]/[sqlite3]/lib/sqlite3-binding.js:4:15

  - loader.js:778 Module._compile
    internal/modules/cjs/loader.js:778:30

  - loader.js:789 Object.Module._extensions..js
    internal/modules/cjs/loader.js:789:10

  - loader.js:653 Module.load
    internal/modules/cjs/loader.js:653:32

  - loader.js:593 tryModuleLoad
    internal/modules/cjs/loader.js:593:12

  - loader.js:585 Function.Module._load
    internal/modules/cjs/loader.js:585:3

  - loader.js:692 Module.require
    internal/modules/cjs/loader.js:692:17

  - helpers.js:25 require
    internal/modules/cjs/helpers.js:25:18

  - sqlite3.js:2 Object.<anonymous>
    [lib]/[gtfs-to-html]/[sqlite3]/lib/sqlite3.js:2:15

  - loader.js:778 Module._compile
    internal/modules/cjs/loader.js:778:30

  - loader.js:789 Object.Module._extensions..js
    internal/modules/cjs/loader.js:789:10

  - loader.js:653 Module.load
    internal/modules/cjs/loader.js:653:32

I'm not super confident with npm so I have no idea of what is happening :)

mzzntn commented 4 years ago

I've tried #89

~/gtfs-to-html$ sudo npm install gtfs-to-html --unsafe-perm --allow-root -g

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
/usr/local/bin/gtfs-to-html -> /usr/local/lib/node_modules/gtfs-to-html/bin/gtfs-to-html.js
+ gtfs-to-html@1.2.1
updated 1 package in 12.689s

then

~/gtfs-to-html$ gtfs-to-html
internal/modules/cjs/loader.js:883
  throw err;
  ^

[  Error: Cannot find module '/usr/local/lib/node_modules/gtfs-to-html/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.  node'
  Require stack:
  - /usr/local/lib/node_modules/gtfs-to-html/node_modules/sqlite3/lib/sqlite3-binding.js
  - /usr/local/lib/node_modules/gtfs-to-html/node_modules/sqlite3/lib/sqlite3.js
  - /usr/local/lib/node_modules/gtfs-to-html/node_modules/gtfs/lib/db.js
  - /usr/local/lib/node_modules/gtfs-to-html/node_modules/gtfs/lib/import.js
  - /usr/local/lib/node_modules/gtfs-to-html/node_modules/gtfs/lib/gtfs.js
  - /usr/local/lib/node_modules/gtfs-to-html/node_modules/gtfs/index.js
  - /usr/local/lib/node_modules/gtfs-to-html/lib/log-utils.js
  - /usr/local/lib/node_modules/gtfs-to-html/bin/gtfs-to-html.js

  - loader.js:880 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:880:15

  - loader.js:725 Function.Module._load
    internal/modules/cjs/loader.js:725:27

  - loader.js:952 Module.require
    internal/modules/cjs/loader.js:952:19

  - helpers.js:88 require
    internal/modules/cjs/helpers.js:88:18

  - sqlite3-binding.js:4 Object.<anonymous>
    [lib]/[gtfs-to-html]/[sqlite3]/lib/sqlite3-binding.js:4:15

  - loader.js:1063 Module._compile
    internal/modules/cjs/loader.js:1063:30

  - loader.js:1092 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1092:10

  - loader.js:928 Module.load
    internal/modules/cjs/loader.js:928:32

  - loader.js:769 Function.Module._load
    internal/modules/cjs/loader.js:769:14

  - loader.js:952 Module.require
    internal/modules/cjs/loader.js:952:19

  - helpers.js:88 require
    internal/modules/cjs/helpers.js:88:18

  - sqlite3.js:2 Object.<anonymous>
    [lib]/[gtfs-to-html]/[sqlite3]/lib/sqlite3.js:2:15

  - loader.js:1063 Module._compile
    internal/modules/cjs/loader.js:1063:30

  - loader.js:1092 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1092:10

  - loader.js:928 Module.load
    internal/modules/cjs/loader.js:928:32

  - loader.js:769 Function.Module._load
    internal/modules/cjs/loader.js:769:14

] {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/gtfs-to-html/node_modules/sqlite3/lib/sqlite3-binding.js',
    '/usr/local/lib/node_modules/gtfs-to-html/node_modules/sqlite3/lib/sqlite3.js',
    '/usr/local/lib/node_modules/gtfs-to-html/node_modules/gtfs/lib/db.js',
    '/usr/local/lib/node_modules/gtfs-to-html/node_modules/gtfs/lib/import.js',
    '/usr/local/lib/node_modules/gtfs-to-html/node_modules/gtfs/lib/gtfs.js',
    '/usr/local/lib/node_modules/gtfs-to-html/node_modules/gtfs/index.js',
    '/usr/local/lib/node_modules/gtfs-to-html/lib/log-utils.js',
    '/usr/local/lib/node_modules/gtfs-to-html/bin/gtfs-to-html.js'
  ]
}
mzzntn commented 4 years ago

Solved :)

I'm not 100% sure of what I've done but for sure I downloaded node through snap and then ran sudo npm install -g gtfs-to-html --unsafe-perm=true --allow-root

brendannee commented 4 years ago

Great to hear. Let me know if you have any other issue or if you end up using this to generate timetables for an agency website.