BlinkTagInc / gtfs-to-geojson

Generate geoJSON of transit route data from a GTFS file.
MIT License
114 stars 23 forks source link

package.json not found #28

Open AvidDabbler opened 1 month ago

AvidDabbler commented 1 month ago

I have been struggling with gtfs-to-html and gtfs-to-geojson for a couple of days. After no success getting it working on my existing project and creating some new remix projects I was not able to get it to work.

Then this am i created a fresh bun project and I have found that the gtfs-to-geojson is causing an issue where it says that it cannot fine the package.json file.

You can take a look at the project here, then run pnpm gtfs

https://github.com/AvidDabbler/bun-gtfs

> gtfs-bun@ gtfs /Users/walter/Documents/transitchat/bun-gtfs
> bun gtfs/index.ts

484 | var stops_dissolved_default = stopsDissolved;
485 | 
486 | // src/lib/gtfs-to-geojson.ts
487 | var limit = pLimit(20);
488 | var { version } = JSON.parse(
489 |   readFileSync(new URL("../../package.json", import.meta.url).pathname, "utf8")
        ^
ENOENT: No such file or directory
   errno: -2
 syscall: "open"
   path: "/Users/walter/Documents/transitchat/bun-gtfs/node_modules/.pnpm/gtfs-to-geojson@3.7.4/node_modules/package.json"

      at /Users/walter/Documents/transitchat/bun-gtfs/node_modules/.pnpm/gtfs-to-geojson@3.7.4/node_modules/gtfs-to-geojson/dist/index.js:489:3

Bun v1.1.20 (macOS arm64)
brendannee commented 1 month ago

Good catch - this has to do with how the path is different for the code in the /dist folder vs the /src.

I pushed an update https://github.com/BlinkTagInc/gtfs-to-geojson/releases/tag/3.7.5 which should solve this by changing how the version is loaded from package.json.

Let me know if that solves the issue.