nodemon: [nodemon] Internal watch failed: Circular symlink detected

  • nodemon -v: 2.0.5
  • node -v: 12.19.0
  • Operating system/terminal environment:
  • Using Docker? What image: node:lts-alpine
  • Command you ran: CMD [“nodemon”, “–config”, “/app/src/ScheduleService-nodemon.json”, “/app/src/ScheduleService/index.js”]

Before this hell started, Nodemon was working fine. I have deleted all Docker images and caches and re-build everything from scratch. So the versions should be the latest.

Expected behaviour

Nodemon should be monitoring files without issues.

Actual behaviour

Nodemon reports an error: … [nodemon] Internal watch failed: Circular symlink detected: “/sys/class/cpuid/cpu0/subsystem” points to “/sys/class/cpuid” … [nodemon] Internal watch failed: Circular symlink detected: “/sys/class/bdi/0:85/subsystem” points to “/sys/class/bdi” …

Steps to reproduce

Start the image.


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 21 (4 by maintainers)

Most upvoted comments

I am running a nodejs application inside a docker container.

I solved creating a nodemon.json on my project root with this content:

{
  "watch": ["src"],
  "ext": "js"
}

The watch option only update when anything on my src folder changes. Without it, nodemon watches all files of the system, generating the error. Maybe a possible fix is to make nodemon observe by default the files on current directory and subdirectories.

Okay I just solved this, although tbh I am not exactly sure what caused the issue in the first place. Seems to be a Docker configuration issue though, not an issue with nodemon.

  1. Change dockerfile like so:
 FROM node:14.15.0
 # add this line
 WORKDIR /app 
 # change second '.' to '/app'
 COPY . /app 
 RUN npm install 
 CMD npm run dev
  1. Build the image and then run it in a container with interactive terminal (optional), mounting a volume from the current host directory (pwd) to the WORKDIR (/app) in the container:
docker build -t imagename:tag .
docker run -it -p 1234:1234 -v $(pwd):/app imagename:tag

Or, with docker-compose.yml

version: '3.6'
services:
  server:
    build: .
    volumes:
    - .:/app
    ports:
    - "3000:3000"

Then run

docker-compose up --build

Getting a similar issue here:

  • Docker Image: osgeo/gdal:ubuntu-small-latest (based on ubuntu:20.04)
  • node -v: v10.19.0
  • nodemon -v: 2.0.6
  • Command: nodemon -L /my-app/index.js

[nodemon] Internal watch failed: Circular symlink detected: “/usr/bin/X11” points to “/usr/bin”

@haydenlinder do you think this (your solution) belongs in the FAQ?