Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.8K
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!