Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
Node.js docker can't install npm dependencies

I have this Dockerfile

FROM node:14

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

EXPOSE 3000

CMD [ "node", "app.mjs" ]

And I can successfully run

docker run hello-world

on my ubuntu 20.10 OS. So I am assuming that docker is installed successfully. But when I tried to run

docker build .

It gives me this error

enter image description here

This is not something with the npm. I can locally install the dependencies without any issue. I assume Dokcer can't access npm registry to pull the npm packages. Something to do with networks I guess.

How do I fix this issue?

This is my code https://github.com/Enuri-Information-Systems/docker-test

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Depending on the network configuration it could happen that you run into problems that the container is not able to connect to a server to download data. This can have various reasons and also depends on how you run docker.

One common thing is that your network requires the usage of a proxy. But only having the error message it is not possible to tell what the exact reason in your case is.

One solution to that problem is to specify the network mode. Adding --network host as an option should most of the time work.

So running your build command that way docker build --network=host . should work.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!