Error: ENOENT: no such file or directory, open '/app/build/index.js.map'

I’m getting an Error: ENOENT: no such file or directory, open ‘/app/build/index.js.map’ error when trying to deploy my remix app. I haven’t deployed in about 2 months, but after some changes when I deployed yesterday I started getting this error.

$ fly logs -a pencils-mvp

Waiting for logs...

2024-03-28T18:46:58.735 app[e784922a631083] yyz [info] [ 0.045268] PCI: Fatal: No config space access function found

2024-03-28T18:46:58.947 app[e784922a631083] yyz [info] INFO Starting init (commit: 88af1610)...

2024-03-28T18:46:58.967 app[e784922a631083] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2024-03-28T18:46:58.982 app[e784922a631083] yyz [info] INFO [fly api proxy] listening at /.fly/api

2024-03-28T18:46:58.986 runner[e784922a631083] yyz [info] Machine started in 417ms

2024-03-28T18:46:58.990 app[e784922a631083] yyz [info] 2024/03/28 18:46:58 listening on [fdaa:3:6a77:a7b:8a0f:825:2be8:2]:22 (DNS: [fdaa::3]:53)

2024-03-28T18:46:59.756 app[e784922a631083] yyz [info] > pencils-mvp@ start /app

2024-03-28T18:46:59.756 app[e784922a631083] yyz [info] > remix-serve ./build/index.js

2024-03-28T18:46:59.988 proxy[e784922a631083] yyz [info] machine started in 1.423959272s

2024-03-28T18:47:01.124 app[e784922a631083] yyz [info] [remix-serve] http://localhost:3000 (http://172.19.134.106:3000)

2024-03-28T18:47:01.193 proxy[e784922a631083] yyz [info] machine became reachable in 1.204695764s

2024-03-28T18:47:01.310 app[e784922a631083] yyz [info] GET / 500 148 - 100.433 ms

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] Error: ENOENT: no such file or directory, open '/app/build/index.js.map'

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at Object.readFileSync (node:fs:453:20)

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at Array.retrieveSourceMap (/app/node_modules/.pnpm/@remix-run+serve@2.4.1_typescript@5.3.3/node_modules/@remix-run/serve/dist/cli.js:50:37)

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at /app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:85:24

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at mapSourcePosition (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:216:21)

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at wrapCallSite (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:397:20)

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at Function.prepareStackTrace (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:446:39)

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at maybeOverridePrepareStackTrace (node:internal/errors:142:29)

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at prepareStackTrace (node:internal/errors:116:5)

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at getStackString (node:internal/util/inspect:1240:16)

2024-03-28T18:47:01.313 app[e784922a631083] yyz [info] at formatError (node:internal/util/inspect:1369:15)

2024-03-28T18:51:46.108 app[e784922a631083] yyz [info] Error: No route matches URL "/robots.txt"

2024-03-28T18:51:46.108 app[e784922a631083] yyz [info] at getInternalRouterError (/app/node_modules/.pnpm/@remix-run+router@1.14.1/node_modules/@remix-run/router/router.ts:4483:5)

2024-03-28T18:51:46.108 app[e784922a631083] yyz [info] at Object.query (/app/node_modules/.pnpm/@remix-run+router@1.14.1/node_modules/@remix-run/router/router.ts:2933:19)

2024-03-28T18:51:46.108 app[e784922a631083] yyz [info] at handleDocumentRequestRR (/app/node_modules/.pnpm/@remix-run+server-runtime@2.4.1_typescript@5.3.3/node_modules/@remix-run/server-runtime/dist/server.js:180:35)

2024-03-28T18:51:46.108 app[e784922a631083] yyz [info] at requestHandler (/app/node_modules/.pnpm/@remix-run+server-runtime@2.4.1_typescript@5.3.3/node_modules/@remix-run/server-runtime/dist/server.js:105:24)

2024-03-28T18:51:46.108 app[e784922a631083] yyz [info] at /app/node_modules/.pnpm/@remix-run+express@2.4.1_express@4.18.2_typescript@5.3.3/node_modules/@remix-run/express/dist/server.js:41:28

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] ErrorResponseImpl {

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] status: 404,

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] statusText: 'Not Found',

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] internal: true,

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] data: 'Error: No route matches URL "/robots.txt"',

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] error: Error: No route matches URL "/robots.txt"

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] at getInternalRouterError (/app/node_modules/.pnpm/@remix-run+router@1.14.1/node_modules/@remix-run/router/router.ts:4483:5)

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] at Object.query (/app/node_modules/.pnpm/@remix-run+router@1.14.1/node_modules/@remix-run/router/router.ts:2933:19)

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] at handleDocumentRequestRR (/app/node_modules/.pnpm/@remix-run+server-runtime@2.4.1_typescript@5.3.3/node_modules/@remix-run/server-runtime/dist/server.js:180:35)

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] at requestHandler (/app/node_modules/.pnpm/@remix-run+server-runtime@2.4.1_typescript@5.3.3/node_modules/@remix-run/server-runtime/dist/server.js:105:24)

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] at /app/node_modules/.pnpm/@remix-run+express@2.4.1_express@4.18.2_typescript@5.3.3/node_modules/@remix-run/express/dist/server.js:41:28

2024-03-28T18:51:46.120 app[e784922a631083] yyz [info] }

2024-03-28T18:51:46.128 app[e784922a631083] yyz [info] GET /robots.txt 404 - - 19.934 ms

2024-03-28T18:52:37.070 proxy[e784922a631083] yyz [info] Downscaling app pencils-mvp from 1 machines to 0 machines, stopping machine e784922a631083 (region=yyz, process group=app)

2024-03-28T18:52:37.076 app[e784922a631083] yyz [info] INFO Sending signal SIGINT to main child process w/ PID 306

2024-03-28T18:52:42.076 app[e784922a631083] yyz [info] INFO Sending signal SIGTERM to main child process w/ PID 306

2024-03-28T18:52:42.078 app[e784922a631083] yyz [info]  ELIFECYCLE  Command failed.

2024-03-28T18:52:42.390 app[e784922a631083] yyz [info] INFO Main child exited with signal (with signal 'SIGTERM', core dumped? false)

2024-03-28T18:52:42.411 app[e784922a631083] yyz [info] INFO Starting clean up.

2024-03-28T18:52:42.412 app[e784922a631083] yyz [info] [ 343.710136] reboot: Restarting system

2024-03-28T18:53:00.299 runner[e784922a631083] yyz [info] Pulling container image registry.fly.io/pencils-mvp:deployment-01HT36EKP3CQE5G9E374BWS9JN

2024-03-28T18:53:14.381 runner[e784922a631083] yyz [info] Successfully prepared image registry.fly.io/pencils-mvp:deployment-01HT36EKP3CQE5G9E374BWS9JN (14.081887931s)

2024-03-28T18:53:14.756 runner[e784922a631083] yyz [info] Configuring firecracker

2024-03-28T18:53:24.257 proxy[e784922a631083] yyz [info] Starting machine

2024-03-28T18:53:24.429 app[e784922a631083] yyz [info] [ 0.048873] PCI: Fatal: No config space access function found

2024-03-28T18:53:24.652 app[e784922a631083] yyz [info] INFO Starting init (commit: 88af1610)...

2024-03-28T18:53:24.671 app[e784922a631083] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2024-03-28T18:53:24.682 app[e784922a631083] yyz [info] INFO [fly api proxy] listening at /.fly/api

2024-03-28T18:53:24.692 runner[e784922a631083] yyz [info] Machine started in 428ms

2024-03-28T18:53:24.693 app[e784922a631083] yyz [info] 2024/03/28 18:53:24 listening on [fdaa:3:6a77:a7b:8a0f:825:2be8:2]:22 (DNS: [fdaa::3]:53)

2024-03-28T18:53:25.443 app[e784922a631083] yyz [info] > pencils-mvp@ start /app

2024-03-28T18:53:25.443 app[e784922a631083] yyz [info] > remix-serve ./build/index.js

2024-03-28T18:53:25.694 proxy[e784922a631083] yyz [info] machine started in 1.437743415s

2024-03-28T18:53:26.764 app[e784922a631083] yyz [info] [remix-serve] http://localhost:3000 (http://172.19.134.106:3000)

2024-03-28T18:53:27.028 proxy[e784922a631083] yyz [info] machine became reachable in 1.333859752s

2024-03-28T18:53:27.152 app[e784922a631083] yyz [info] GET / 500 148 - 101.782 ms

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] Error: ENOENT: no such file or directory, open '/app/build/index.js.map'

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at Object.readFileSync (node:fs:453:20)

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at Array.retrieveSourceMap (/app/node_modules/.pnpm/@remix-run+serve@2.4.1_typescript@5.3.3/node_modules/@remix-run/serve/dist/cli.js:50:37)

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at /app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:85:24

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at mapSourcePosition (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:216:21)

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at wrapCallSite (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:397:20)

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at Function.prepareStackTrace (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:446:39)

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at maybeOverridePrepareStackTrace (node:internal/errors:142:29)

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at prepareStackTrace (node:internal/errors:116:5)

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at getStackString (node:internal/util/inspect:1240:16)

2024-03-28T18:53:27.155 app[e784922a631083] yyz [info] at formatError (node:internal/util/inspect:1369:15)

2024-03-28T18:54:24.121 app[e784922a631083] yyz [info] GET / 500 148 - 3.277 ms

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] Error: ENOENT: no such file or directory, open '/app/build/index.js.map'

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at Object.readFileSync (node:fs:453:20)

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at Array.retrieveSourceMap (/app/node_modules/.pnpm/@remix-run+serve@2.4.1_typescript@5.3.3/node_modules/@remix-run/serve/dist/cli.js:50:37)

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at /app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:85:24

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at mapSourcePosition (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:216:21)

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at wrapCallSite (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:397:20)

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at Function.prepareStackTrace (/app/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:446:39)

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at maybeOverridePrepareStackTrace (node:internal/errors:142:29)

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at prepareStackTrace (node:internal/errors:116:5)

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at getStackString (node:internal/util/inspect:1240:16)

2024-03-28T18:54:24.122 app[e784922a631083] yyz [info] at formatError (node:internal/util/inspect:1369:15)

2024-03-28T18:54:28.591 app[e784922a631083] yyz [info] GET / 500 148 - 6.241 ms

2024-03-28T18:54:28.592 app[e784922a631083] yyz [info] Error: ENOENT: no such file or directory, open '/app/build/index.js.map'```

I ran fly console and checked build for index.js.map and its not there. How would I ensure it is there whenever I run fly deploy.

The issue was that pnpm run build was not creating index.js.map.

I fixed it by changing the pnpm run build to pnpm run build --sourcemap in the dockerfile.

Was that Dockerfile provided by fly launch or by one of the Remix stacks?

Is there some way for us to detect whether sourcemaps are needed based on scanning your source?

I ask because the Dockerfiles provided by, for example, the Blues stack doesn’t contain this:

I’m actually not sure. I think it’s likely from remix since the dockerfile you showed does actually contain npm run build towards the bottom.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.