Accessing node_modules after npm install inside Docker

心已入冬 提交于 2019-12-04 14:34:27

Since you are using boot2docker, only Max host folder /Users/ is mounted and accessible from the boot2docker host.

That means you would need to map /home/app/node_modules to a Mac host path starting with /Users, to see said modules on your Mac host.

volumes:
    - /Users/andre/IdeaProjects/app:/home/app
    - /Users/andre/node_modules:/home/app/node_modules

You will not be able to access on your host to your node_modules folder inside the container. It is not recommended to bind this folder to your host folder node_modules cause It will cause problems while building the images.

One cheap solution will be to use the Visual Studio Code Extension called "Remote-Containers". This extension will allow you to attach your Visual Studio Code to your container an edit transparently files within your container folders. To do so, it will install an internal vscode server within your development container. For more information check this link.

Ensure, however, that your volumes still are created in your docker-compose.yml file.

I hope it helps :D!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!