Unable to run fly deploy, being presented with lockfile would have been modified

Getting this error upon running yarn install --immutable on the dockerfile when deploying


=> ERROR [build 4/5] RUN yarn install --immutable                               4.2s 
------
 > [build 4/5] RUN yarn install --immutable:
#0 0.667
#0 0.714 ➤ YN0000: ┌ Resolution step
#0 0.975 ➤ YN0032: │ sharp@npm:0.32.5: Implicit dependencies on node-gyp are discouraged      
#0 1.130 ➤ YN0032: │ node-addon-api@npm:6.1.0: Implicit dependencies on node-gyp are discouraged
#0 2.328 ➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged    
#0 4.107 ➤ YN0000: └ Completed in 3s 392ms
#0 4.136 ➤ YN0000: ┌ Post-resolution validation
#0 4.136 ➤ YN0028: │ The lockfile would have been modified by this install, which is explicitly forbidden.
#0 4.136 ➤ YN0000: └ Completed
#0 4.136 ➤ YN0000: Failed with errors in 3s 424ms
------

DockerFile


# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired

ARG NODE_VERSION=20.5.0

FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="Node.js"

# Node.js app lives here

WORKDIR /app

# Set production environment

ENV NODE_ENV="production"

ARG YARN_VERSION=3.3.1

# Install Yarn 3

RUN corepack enable && \

yarn set version ${YARN_VERSION}

# 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.json yarn.lock ./

RUN yarn install --immutable

# 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

EXPOSE 3000

CMD [ "yarn", "run", "start" ]

This is a yarn issue. Does running it locally work?

It works fine locally. I have also resolved to the point where I updated my yarn locally to match the version on the dockerfile. It seems to deploy but then I am now facing this issue

  [    0.036212] PCI: Fatal: No config space access function found
   INFO Starting init (commit: b437b5b)...
   INFO Mounting /dev/vdb at /data w/ uid: 0, gid: 0 and chmod 0755
   INFO Resized /data to 3217031168 bytes
   INFO Preparing to run: `docker-entrypoint.sh yarn run start` as root
   INFO [fly api proxy] listening at /.fly/api
  2023/08/19 07:51:13 listening on <IP> (DNS: <DNS>)
  Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)
  $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
   INFO Main child exited normally with code: 1
   INFO Starting clean up.
   INFO Umounting /dev/vdb from /data
   WARN hallpass exited, pid: 264, status: signal: 15 (SIGTERM)
  2023/08/19 07:51:15 listening on <IP> (DNS:<DNS>)
  [    3.296503] reboot: Restarting system
  machine did not have a restart policy, defaulting to restart
Error: smoke checks for 3287454db64318 failed: the app appears to be crashing

Hid the IP and DNS because im not sure how safe it is to show there

Ok now its saying this

sin [error] instance refused connection. is your app listening on 0.0.0.0:3000? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)

Im very confused as I didnt need to do this before.

I added this to my nodejs app and it still throws the error

app.listen(port, '0.0.0.0', () => {
  console.log(`Server running on 0.0.0.0:${port}`);
});

Though the logs say (again, ip is hidden)

2023/08/19 08:07:20 listening on [<ip>:a7b:fe:2836:9568:2]:22 (DNS: [<DNS>::3]:53)

I’ve never felt dumber. The issue was the port. Not the IP, i’ve been hosting it on 8080 instead of 3000. Really sorry for the waste of a post. Though a good disclaimer to always check the port in fly.toml as well

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