Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
152 votes
12 answers
331k views

npm WARN old lockfile The package-lock.json file was created with an old version of npm

I have a dockerfile as shown below, and when i execute it, I get a warning that i can't figure out in the RUN npm ci step: npm WARN old lockfile The package-lock.json file was created with an old ...
semural's user avatar
  • 4,311
113 votes
14 answers
124k views

Install node_modules inside Docker container and synchronize them with host

I have the problem with installing node_modules inside the Docker container and synchronize them with the host. My Docker's version is 18.03.1-ce, build 9ee9f40 and Docker Compose's version is 1.21.2,...
Vlad Turak's user avatar
  • 6,224
109 votes
17 answers
184k views

How to set npm credentials using `npm login` without reading from stdin?

I'm trying to automate npm publish inside a Docker container, but I receive an error when the npm login command tries to read the username and email: npm login << EOF username password email EOF ...
shawnzhu's user avatar
  • 7,475
81 votes
8 answers
104k views

Docker Node Alpine Image Build Fails on node-gyp

I'm attempting to Dockerize a Vue.js application. I'm using the node:10.15-alpine Docker image as a base. The image build fails with the following error: gyp ERR! configure error gyp ERR! stack Error:...
Jason's user avatar
  • 2,710
76 votes
9 answers
241k views

Cannot find module for a node js app running in a docker compose environment

I am sorry for my very newbie question, but I am having a terrible day figuring out this error, I have an Express app and I am trying to run it in docker compose. I've used this Dockerfile: FROM ...
jemlifathi's user avatar
  • 1,552
68 votes
13 answers
44k views

npm install fails in jenkins pipeline in docker

I'm following a tutorial about Jenkins pipeline and I can get a "hello world" working under at node 6.10 docker container. But, when I added a default EmberJS app (using ember init) to the repo and ...
les2's user avatar
  • 14.3k
46 votes
8 answers
104k views

How to build Docker Images with Dockerfile behind HTTP_PROXY by Jenkins?

Building Docker images works in a desktop without a problem. Installing Node.js NPM dependencies work as usual. However, when using a continuous integration server such as Jenkins that is hosted ...
Marcello DeSales's user avatar
41 votes
5 answers
28k views

No access permission error with npm global install on docker image

I'm trying to build a docker image with a global install of firebase-tools and angular-cli. I'm building the same image for two versions of node: 6.x (LTS boron) and v8.x (latest alpine). Locally, ...
Gabriel Araujo's user avatar
34 votes
3 answers
17k views

How to build docker images in a lerna monorepo without publishing

The use case for this is branch building and deployments in Lerna monorepos. The problem is that Lerna monorepos either hoist dependencies in NPM or use yarn workspaces to the same effect to collect ...
Gudlaugur Egilsson's user avatar
28 votes
9 answers
38k views

You installed esbuild on another platform than the one you're currently using

I am trying to containerise Svelte js app inside a docker container and I am getting this error on the log complaining about esbuild in a different platform , I am using M1 mac, I have tried to ...
Yusuf's user avatar
  • 3,213
28 votes
5 answers
37k views

How to resolve "The cypress npm package is installed, but the Cypress binary is missing."

I'm trying to download and install Cypress within GitLab CI runner and getting this error output: The cypress npm package is installed, but the Cypress binary is missing. We expected the binary to be ...
road_runner's user avatar
27 votes
7 answers
45k views

docker build + private NPM (+ private docker hub)

I have an application which runs in a Docker container. It requires some private modules from the company's private NPM registry (Sinopia), and accessing these requires user authentication. The ...
GTF's user avatar
  • 8,255
26 votes
3 answers
129k views

Unsupported engine node / NPM only when building in Docker

I have a dependency in my package.json which itself has the following dependency: "node-rdkafka": "^2.5.0", Using nvm on my local machine and setting my node version to 8.9.1, and my npm version is ...
Greg Peckory's user avatar
  • 7,940
25 votes
13 answers
64k views

(EACCES: permission denied, mkdir '/usr/app/node_modules/.cache) How can I create a docker-compose file to make node_modules a non-root folder?

I'm trying to dockerize a simple create-react-app project. (Is the initial project after running npx create-react-app test, no files were changed). The problem seems to be that in newer versions of ...
Sebastián Suárez Valencia's user avatar
24 votes
2 answers
9k views

npm : Postinstall not running in docker

I have a npm package (npm v 5.5.1 and node version is 9.2.0). If i run npm install on local machine then the postinstall defined in package.json is executed but if I run the same command RUN npm ...
user2608576's user avatar
23 votes
3 answers
20k views

How to integrate 'npm install' into ASP.NET CORE 2.1 Docker build

I have not found a way to build a ASP.NET Core 2.1 Docker image while doing a proper npm install during the build process. My Dockerfile looks like this (one that has been generated from Visual ...
dannyyy's user avatar
  • 1,784
23 votes
8 answers
74k views

Docker: npm not found

I have the following Dockerfile: FROM ubuntu USER root RUN apt-get update && apt-get install curl -y RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - RUN apt-get update && ...
Sohrab's user avatar
  • 1,448
23 votes
4 answers
18k views

linux-x64 binaries cannot be used on the linuxmusl-x64 platform error

I'm installing the Sharp package for image compression on the docker image for a Nodejs project with package.json. When I create the container I get the following error regarding to the sharp package: ...
Farzaneh Torkpichlou's user avatar
23 votes
1 answer
21k views

Docker and npm - gyp ERR! not ok

Everything was working with my client until I tried to solve some Network disconnected issue by upgrading react-scripts in my docker client service from 3.0.1 to 3.3.0, using npm install <package&...
8-Bit Borges's user avatar
  • 9,925
23 votes
3 answers
26k views

Prevent node from running out of memory in a docker build that a 600 MB memory limit

I am running docker build with a limit on the build's memory and CPU. To stay within the build's CPU and memory limits, I am also limiting Node to a heap size of 325 MB. This is the docker build ...
Shaun Luttin's user avatar
22 votes
2 answers
14k views

Should I copy `package-lock.json` to the container image in Dockerfile?

Here is my Dockerfile: FROM node:12-slim ENV NODE_ENV=production WORKDIR / # COPY . . # COPY ENTIRE FOLDER ? COPY ./package.json ./package.json COPY ./dist ./dist RUN npm install --only=...
cbdeveloper's user avatar
  • 30.4k
22 votes
5 answers
95k views

How can I run an npm command in a docker container?

I am trying to run an angular application in development mode inside a docker container, but when i run it with docker-compose build it works correctly but when i try to put up the container i obtain ...
Ratchet's user avatar
  • 263
22 votes
1 answer
7k views

VS Code IntelliSense enabled when developing inside a Docker container

I'm wondering whether it is possible to have VS Code IntelliSense enabled when developing inside a Docker container where all the dependencies are locally installed?
John Gray's user avatar
  • 221
20 votes
5 answers
34k views

Docker: npm install behind proxy

I have this Dockerfile: FROM node:argon ENV http_proxy http://user:[email protected]:3128 ENV https_proxy https://user:[email protected]:3128 RUN mkdir -p /usr/src/app WORKDIR /usr/src/...
Héctor's user avatar
  • 25.4k
20 votes
2 answers
22k views

How can I pass 'yes' response when npm installing on Dockerfile

I have a Dockerfile like below : FROM node:latest RUN npm install something && \ npm install something && \ npm install something I want to pass 'yes' response for all ...
sam's user avatar
  • 1,173
20 votes
1 answer
18k views

Docker - Watch logs in real time while building image

I'm building a Docker image from a Dockerfile, but I dont know if when I execute the npm install command, the server is installing the dependencies from packege.json. I want to check in real time the ...
dpolicastro's user avatar
  • 1,479
19 votes
2 answers
38k views

How to install Nodejs 8.12 in alpine:3.8?

I am writing a Dockerfile to dockerize a sample nodejs app. I developed that in Nodejs v8.12 and npm 6.4.1. I know that I can use node:8.12-alpine image to get results. But I am using alpine:3.8 image ...
Karthick's user avatar
  • 323
19 votes
1 answer
7k views

Setting up docker nodejs application with local npm dependencies

We want to start containerizing our applications, but we have stumbled upon some issues with local dependencies. We have a single git repository, in which we have numerous node packages, under "...
RomanY's user avatar
  • 406
19 votes
5 answers
36k views

Docker and private packages with .npmrc

I am using a .npmrc file to configure a private repo (font-awesome-pro). It works well without docker. But with docker, the npm install fails: npm ERR! code E401 npm ERR! 404 401 Unauthorized: @...
Thomas's user avatar
  • 1,599
19 votes
2 answers
5k views

How to get docker and npm workspaces to work fine without copying root master node_modules everywhere

I have a project structure like so: +-- node_modules +-- package-lock.json +-- package.json `-- workspace-a `-- package.json <---includes common as a dependency `-- common `-- package.json ...
reactor's user avatar
  • 1,882
18 votes
4 answers
25k views

How to install global npm dependencies in docker?

Getting Error: EACCES: permission denied, open '/usr/local/lib/node_modules when trying to install a global module in docker: FROM node:latest RUN mkdir -p /code RUN npm i -g npm WORKDIR /code RUN ...
locropulenton's user avatar
18 votes
7 answers
12k views

AWS-CDK and Gitlab returns Error: spawnSync docker ENOENT

I am trying to run a Gitlab pipeline that builds an AWS-CDK project via the cdk-synth command. I have followed advice online in terms of what images I should be using in the Gitlab runner but I am ...
red house 87's user avatar
  • 2,265
17 votes
1 answer
14k views

install private npm package in gitlab pipelines

If one needs to install private repositories with npm the environment variable NPM_TOKEN needs to be set. NPM_TOKEN=00000000-0000-0000-0000-000000000000 My build stage in gitlab pipelines needs to ...
Ced's user avatar
  • 16.9k
17 votes
2 answers
21k views

Why does `package-lock.json` causes a failure in a docker container build when `npm install`?

There are a lot of people online asking this same question in different ways but there is no clear answer. Can anybody understand enough to explain why a docker build fails when package-lock.json file ...
dugong's user avatar
  • 4,183
16 votes
8 answers
21k views

How to run swagger-ui with local code changes AND my own swagger.json?

The Readme on https://github.com/swagger-api/swagger-ui specifies that Swagger-UI can be run with your own file like this docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo ...
Harald Nordgren's user avatar
16 votes
2 answers
12k views

Npm install is failing with docker buildx linux/arm64

I'm building a docker image from a x86_64 machine for the deployment server which is arm64. For testing I'm using the docker file below. FROM node:14.16.0-buster RUN npm install pm2@latest -g For ...
Sp4Rx's user avatar
  • 1,608
15 votes
2 answers
22k views

NaCl helper process running without a sandbox! error when running npm tests

I'n having a problem when running some npm test. The error I'm receiving is: "NaCl helper process running without a sandbox!", which is true, as I'm running the browser with the "--no-sandbox" option. ...
user3134453's user avatar
14 votes
3 answers
13k views

Npm not found when running docker container from node image

# Dockerfile FROM node:7-alpine RUN mkdir -p /src/app WORKDIR /src/app COPY package.json /src/app/package.json RUN npm install COPY . /src/app EXPOSE 3000 CMD ['npm', 'start'] I'm trying to complete ...
Peter's user avatar
  • 4,651
14 votes
2 answers
16k views

How to set a Dockerfile ARG in Github actions

I have a Dockerfile for one of my Node.js services that I try to push to my Digitalocean registry through the use of Github actions. My Node.js service requires a private package that is hosted by ...
Danny Hobo's user avatar
14 votes
4 answers
36k views

Please, set "CHROME_BIN" env variable inside docker npm test

'npm run test' works completely fine on the server or on my local but its failing on my docker machine. I am bit new to this docker world so I am just confused about whats going wrong here. I was ...
undefined's user avatar
  • 3,614
14 votes
4 answers
10k views

Conditional CMD in Docker

I'd like to run CMD ["npm", "run", "dev"] if a dev script is present in package.json, otherwise CMD ["npm", "start"] Is there an idiomatic docker way for doing this? I suppose my CMD could be a bash ...
eks's user avatar
  • 141
14 votes
1 answer
2k views

node-gyp compiling against wrong NODE_MODULE_VERSION

I've set up a Gitlab CI pipeline which is compiling a native nodejs addon in the first stage and running some tests with it in the second one. The job is running on the same Docker image: FROM ...
mxcd's user avatar
  • 2,314
13 votes
2 answers
20k views

npm can't find package.json when running docker container with compose

I am trying to wire up my Angular 7 client app into docker compose locally. I get the following error when I docker-compose up: client-app | npm ERR! errno -2 client-app | npm ERR! syscall ...
qubits's user avatar
  • 1,288
13 votes
2 answers
15k views

Do I have to npm install in every step in a bitbucket pipeline that I need to use an npm command

I have a bitbucket pipelines yml that I have step for running my test script and a step to run a serverless deploy script. Do I need to npm install at each step or will the first npm install carry ...
ardev's user avatar
  • 653
13 votes
1 answer
11k views

can't install npm in the docker container?

I am deploying a simple node.js app on a digital ocean server 's docker platform. // package.json { "name": "docker-centos-hello", "private": true, "version": "0.0.1", "description": "Node....
user824624's user avatar
  • 7,745
13 votes
2 answers
10k views

Development dependencies in Dockerfile or separate Dockerfiles for production and testing

I'm not sure if I should create different Dockerfile files for my Node.js app. One for production without the development dependencies and one for testing with the development dependencies included. ...
kgalli's user avatar
  • 259
12 votes
3 answers
19k views

Dockerfile: add npm to an existing docker image

Having a Jenkins Docker image, I would like to add the complete 'npm' environment to that image. So after building the Dockerfile I have an image with both Jenkins and the 'npm' environment. The ...
tm1701's user avatar
  • 7,323
12 votes
2 answers
10k views

failed to load cache key: pull access denied powershell

When running docker file this line failed RUN apt-get update && apt-get install -y wget && apt-get install -y gnupg2 && wget -qO- https://deb.nodesource.com/setup_14.x | bash - ...
Mac Milan's user avatar
  • 121
12 votes
1 answer
6k views

How to upgrade npm to npm@5 on the latest node docker image?

Locally, I have successfully installed npm@5 via: $ npm install npm@5 -g $ npm -v $ 5.0.0 And locally, I can run the npm setup just fine (it's basically npm i && tsc) $ npm run setup ...
k0pernikus's user avatar
  • 64.7k
12 votes
2 answers
14k views

Npm install being slow and lots of "cache miss" after nearly every library

While everything seems to work on my local computer; Whenever I run nodejs inside a docker (docker run node:18) and I clone a project, type npm install to get all libraries and work with them, it is ...
paul23's user avatar
  • 9,259

1
2 3 4 5
23