Home > Net >  How to install npm modules on host machine using docker
How to install npm modules on host machine using docker

Time:10-27

I have nodejs project with a package.json inside the folder. I do not want to install nodejs on my host machine to just to run 'npm install'. I want to use docker to do the npm install for me and destroy the container after.

I have done something similar for a php laravel project like the command below

docker run --rm -v /myapp:/app composer install

The command above installed composer dependencies for my Laravel app and destroyed the container after.

Can I do the same for npm install with 1 line?.

CodePudding user response:

This should do it: docker run --rm -v $PWD:/app -w /app node npm install

  • Related