Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.8K
Vistas
Docker - /bin/sh: nodemon: not found

I have the following docker file.

#Dockerfile

FROM node:alpine

WORKDIR /backend

COPY package*.json .

RUN yarn

COPY . .

EXPOSE 5000

CMD ["yarn", "dev"]

Nodemon works as intended on host machine but shows the following error message when running the container.

yarn run v1.22.5
$ nodemon
/bin/sh: nodemon: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Nodemon is not installed globally in the host machine. Adding RUN yarn add global nodemon on Dockerfile just adds an extra warning ../package.json: No license field in the container error.

I currently have the following package.json file with the following dev dependencies

# package.json
...
"scripts": {
    "build": "tsc -p .",
    "start": "node ./dist/src/index.js",
    "dev": "nodemon",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "devDependencies": {
    "@types/express": "^4.17.11",
    "@types/node": "^14.14.34",
    "nodemon": "^2.0.7",
    "ts-node": "^9.1.1",
    "typescript": "^4.2.3"
  },
...

and nodemon.json as

{
    "watch": [
      "src"
    ],
    "ext": "ts,json",
    "ignore": [
        "src/**/*.spec.ts"
    ],
    "exec": "yarn ts-node src/index.ts"
  }
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Try with below,

#Dockerfile

FROM node:alpine

WORKDIR /backend

COPY package*.json .

RUN yarn

RUN yarn add global nodemon

COPY . .

EXPOSE 5000

CMD ["yarn", "dev"]

SIDE NOTE: You better not using nodemon in production. Serve build files as in your start script. You have to add the build command before yarn start.

#Dockerfile

FROM node:alpine

WORKDIR /backend

COPY package*.json .

RUN yarn

COPY . .

RUN yarn run build

EXPOSE 5000

CMD ["yarn", "start"]
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda