React.js Docker - Module not found

后端 未结 2 639
情深已故
情深已故 2021-01-20 07:00

Prerequisites

Linux 18.04

create-react-app 2.0

docker 19.09.0

Dockerfile

# ba         


        
相关标签:
2条回答
  • 2021-01-20 07:11

    Everything has been working just fine, but after installing a new package docker stopped working as expected. Every time I run docker-compose up it fails with 'Module not found' error.

    You need to rebuild your image to have that package installed. docker-compose build, and then docker-compose up

    EDIT

    Based on your update, I realize that the problem is your old node_module volume persisted between builds. Try docker-compose down -v before up.

    0 讨论(0)
  • 2021-01-20 07:27

    Instead of:

    volumes:
      - '.:/usr/src/app'
      - '/usr/src/app/node_modules'
    

    Try:

    volumes:
      - ./:/usr/src/app
      - /usr/src/app/node_modules
    
    0 讨论(0)
提交回复
热议问题