I was running into a similar problem and solved it by adding an anonymous volume to my node_modules directory in my docker-compose file. So the volumes in your docker-compose file would look like this:

  - './frontend:/frontend:cached'
  - '/frontend/node_modules'

I got the idea from this blog post

Related Query

More Query from same tag