BlinkTagInc / gtfs-to-html

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

Error - 'directory does not exist' #165

Open Lanxtot opened 4 weeks ago

Lanxtot commented 4 weeks ago

Hello. I'm having trouble setting up gtfs-to-html. I'm running it through Git Bash on Windows 11, and it spits out an error. I have already updated Node.js from 20.8.0 using nvm (as it was saying that it was incompatible), and am using config copied from the sample, with the URL changed to https://www.visimarsrutai.lt/gtfs/VilniausR.zip and the agencyKey to VilniausR. This is the error:

`C:\Users\gedim\gtfs-to-html\node_modules\better-sqlite3\lib\database.js:65 throw new TypeError('Cannot open database because the directory does not exist'); ^

TypeError: Cannot open database because the directory does not exist at new Database (C:\Users\gedim\gtfs-to-html\node_modules\better-sqlite3\lib\database.js:65:9) at setupDb (file:///C:/Users/gedim/gtfs-to-html/node_modules/gtfs/lib/db.js:10:14) at openDb (file:///C:/Users/gedim/gtfs-to-html/node_modules/gtfs/lib/db.js:31:12) at file:///C:/Users/gedim/gtfs-to-html/app/index.js:43:3 at ModuleJob.run (node:internal/modules/esm/module_job:218:25) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24) at async loadESM (node:internal/process/esm_loader:28:7) at async handleMainPromise (node:internal/modules/run_main:113:12)

Node.js v20.11.0`

I have little experience with running node apps, so I may be doing something trivial wrong, perhaps installing it incorrectly. I have played around with the config, looked at the files in question, deleted the folder and git clone'd it numerous times, always leading to the same error. Help would be really appreciated.

brendannee commented 4 weeks ago

Can you let me know what value you have in your config.json file for sqlitePath?

The directory you specify needs to exist - or you can remove this line from the config entirely and it will use an in-memory database.

Lanxtot commented 4 weeks ago

It was '/tmp/gtfs'. After removing it, it does run localhost, but then, a completely different error comes up:

SqliteError: no such table: timetables at Database.prepare (C:\Users\gedim\gtfs-to-html\node_modules\better-sqlite3\lib\methods\wrappers.js:5:21) at getTimetables (file:///C:/Users/gedim/gtfs-to-html/node_modules/gtfs/lib/non-standard/timetables.js:28:6) at getTimetablePagesForAgency (file:///C:/Users/gedim/gtfs-to-html/lib/utils.js:1264:48) at file:///C:/Users/gedim/gtfs-to-html/app/index.js:61:7 at Layer.handle [as handle_request] (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\route.js:149:13) at Route.dispatch (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\route.js:119:3) at Layer.handle [as handle_request] (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\layer.js:95:5) at C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\index.js:284:15 at Function.process_params (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\index.js:346:12)

brendannee commented 3 weeks ago

Can you try adding a sqlitePath config value to a folder that does exist?

Maybe C:\Users\gedim\gtfs-to-html\gtfs?

Let me know if that solves the issue.

Lanxtot commented 3 weeks ago

Tried it. Now shows the same error, just coming from the files inside of the gtfs folder:

SqliteError: no such table: timetables at Database.prepare (C:\Users\gedim\gtfs-to-html\node_modules\gtfs\node_modules\better-sqlite3\lib\methods\wrappers.js:5:21) at getTimetables (file:///C:/Users/gedim/gtfs-to-html/node_modules/gtfs/lib/non-standard/timetables.js:28:6) at getTimetablePagesForAgency (file:///C:/Users/gedim/gtfs-to-html/lib/utils.js:1264:48) at file:///C:/Users/gedim/gtfs-to-html/app/index.js:61:7 at Layer.handle [as handle_request] (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\route.js:149:13) at Route.dispatch (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\route.js:119:3) at Layer.handle [as handle_request] (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\layer.js:95:5) at C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\index.js:284:15 at Function.process_params (C:\Users\gedim\gtfs-to-html\node_modules\express\lib\router\index.js:346:12)

brendannee commented 3 weeks ago

Can you share with me the config.json you are using?

And also which version of gtfs-to-html is installed?

   gtfs-to-html --version
Lanxtot commented 3 weeks ago

Here's the file. The version is 2.6.8. config.json

brendannee commented 1 week ago

Thanks for sharing the config.

Can you let me know the full output of the command gtfs-to-html when you run it? For example, here is what I got when trying the config you sent:

gtfs-to-html --configPath config.json

Starting GTFS import for 1 file using SQLite database at :memory:
Downloading GTFS from https://www.visimarsrutai.lt/gtfs/VilniausR.zip
Download successful
Importing GTFS from /private/var/folders/dk/191xmcbs52gb23z5w8ch1q_r0000gn/T/4b4d0ab4a23957147cdae8819f7d51bd/gtfs.zip
Importing - agency.txt - 1 lines imported
Importing - areas.txt - No file found
Importing - attributions.txt - No file found
Importing - booking_rules.txt - No file found
Importing - calendar_dates.txt - No file found
Importing - calendar.txt - 22 lines imported
Importing - fare_attributes.txt - No file found
Importing - fare_leg_rules.txt - No file found
Importing - fare_media.txt - No file found
Importing - fare_products.txt - No file found
Importing - fare_rules.txt - No file found
Importing - fare_transfer_rules.txt - No file found
Importing - feed_info.txt - No file found
Importing - frequencies.txt - No file found
Importing - levels.txt - No file found
Importing - location_groups.txt - No file found
Importing - location_group_stops.txt - No file found
Importing - locations.geojson - No file found
Importing - networks.txt - No file found
Importing - pathways.txt - No file found
Importing - route_networks.txt - No file found
Importing - routes.txt - 78 lines imported
Importing - shapes.txt - 158356 lines imported
Importing - stop_areas.txt - No file found
Importing - stop_times.txt - 15576 lines imported
Importing - stops.txt - 926 lines imported
Importing - timeframes.txt - No file found
Importing - transfers.txt - No file found
Importing - translations.txt - No file found
Importing - trips.txt - 953 lines imported
Completed GTFS import for 1 agency
vrsa: Generating HTML timetables ======================================== 189/189
vrsa: HTML timetables created at /Users/brendannee/Downloads/html/vrsa
┌────────────────────────────────────────┬────────────────────┐
│ Item                                   │ Count              │
├────────────────────────────────────────┼────────────────────┤
│ 📄 Timetable Pages                     │ 189                │
├────────────────────────────────────────┼────────────────────┤
│ 🕑 Timetables                          │ 189                │
├────────────────────────────────────────┼────────────────────┤
│ 📅 Calendar Service IDs                │ 423                │
├────────────────────────────────────────┼────────────────────┤
│ 🔄 Routes                              │ 189                │
├────────────────────────────────────────┼────────────────────┤
│ 🚍 Trips                               │ 1616               │
├────────────────────────────────────────┼────────────────────┤
│ 🛑 Stops                               │ 4204               │
├────────────────────────────────────────┼────────────────────┤
│ ⛔️ Warnings                            │ 0                  │
└────────────────────────────────────────┴────────────────────┘
vrsa: HTML timetable generation required 21 seconds%