Answer the question
In order to leave comments, you need to log in
Is it possible to run npm locally through Docker?
I’m just trying to figure out the docker, please don’t swear too much
There is a project, it has a package.json file
I’m trying to install everything that is there not using npm locally, but somehow through docker
I write the command: docker run node npm install
In response, an error:
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#2 No description
npm WARN !invalid#2 No repository field.
npm WARN !invalid#2 No README data
npm WARN !invalid#2 No license field.
Answer the question
In order to leave comments, you need to log in
I will assume that the project and it package.json
are on the host in the current folder.
Then the command:
More:
docker run \
-it \ // интерактивно и с терминалом
--rm \ // удалить контейнер после выхода
-v "$PWD":/usr/src/app \ // текущую папку на хосте смонтировать в контейнер
-w /usr/src/app \ // в конт. сделать текущей папкой смонтированную
node \ // образ с nodejs
npm install // команда
you need to mount the folder on the fly and it is advisable to delete the container behind you, since you want to directly run the image every time
my .bash_profile
function docker-npm() {
docker run -it --rm -v app-sync:/var/www/sites:nocopy -w=$(pwd) node npm "[email protected]"
}
// -v app-sync:/var/www/sites:nocopy на свое правим
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question