Pricing Blog

route.js error on self hosting

  • luca_6412-1431001774189445203

    Luca_

    21 days ago

    im getting "Unable to load ./routes.js error: Cannot find module "./routes.js" from "/$bunfs/root/nordcraft"" while running nordcraft on a local server.
    1431001774377926676-image.png
  • lucasg-1431002094684344411

    Lucas G

    21 days ago

    Update 'syncStaticAssets.ts' to use '../../runtime/dist' directly as source instead of node_modules link
  • It's likely because you're on bun 1.3+
  • NC repo was still on 1.2.x
  • erikbeus-1431014243393863742

    Erik Beuschau

    21 days ago

    We’re working on bun 1.3.1 support atm 👍 https://github.com/nordcraftengine/nordcraft/pull/623
  • luca_6412-1431291236526063709

    Luca_

    20 days ago

    That was the issue:
  • The compiled Nordcraft binary (dist/nordcraft) loads ./routes.js using a relative import (e.g. import("./routes.js")).

    When the Docker container started in /app, the binary’s working directory was /app,
    but the actual routes.js file was in /app/dist.
  • And this fixed it:
  • Change the container’s working directory to /app/dist,
    so that ./routes.js and the binary are in the same folder.

    In the Dockerfile’s runtime stage:

    WORKDIR /app/dist
    ENTRYPOINT ["./nordcraft"]


    Now the relative imports resolve correctly,
    and Nordcraft can load routes.js, project.js, and other assets without issues.
  • erikbeus-1432264180324368477

    Erik Beuschau

    18 days ago

    Feel free to open a PR on GitHub 🙏