Module not found /app/serverjs

Hi -

I am trying to deploy my second app and am getting these following error logs:

My file structure is as follows

|   |----server.js
|   |----Dockerfile
2024-04-03T21:36:10.880 app[7811301c6293e8] ord [info] Error: Cannot find module '/app/server.js'

2024-04-03T21:36:10.880 app[7811301c6293e8] ord [info] at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)

2024-04-03T21:36:10.880 app[7811301c6293e8] ord [info] at Module._load (node:internal/modules/cjs/loader:901:27)

2024-04-03T21:36:10.880 app[7811301c6293e8] ord [info] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)

I have checked both my package.json and Dockerfile to ensure that they are pointing to server.js, but the issue persists.

My Dockerfile:

# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="Node.js"

# Node.js app lives here

# Set production environment
ENV NODE_ENV="production"

# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
    apt-get install -y build-essential pkg-config python-is-python3

# Install node modules
COPY --link package-lock.json package.json ./
RUN npm ci

# Copy application code
COPY --link . .

# Final stage for app image
FROM base

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
CMD [ "node", "server.js" ]

Still learning about deployment so sorry if this is a simple fix! Please let me know if there is anything else I’d need to provide to get some help deploying this. My other app deployed without issue, so I’m not sure what I’m overlooking with this one.

Are you running fly deploy from the root directory? Can you try this instead?

CMD [ "node", "server/server.js" ]