본문 바로가기

Docker

[Docker] ERROR: failed to solve: process "/bin/sh -c npm install" did not complete successfully: exit code: 1

# CASE1. npm ERR! code ECONNREFUSED

==> apline 대신 node 버전으로 기재 


272.2 npm ERR! code ECONNREFUSED
272.2 npm ERR! errno ECONNREFUSED
272.2 npm ERR! FetchError: request to https://registry.npmjs.org/body-parser failed, reason: connect ECONNREFUSED 104.16.1.35:443
272.2 npm ERR!     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
272.2 npm ERR!     at ClientRequest.emit (events.js:400:28)
272.2 npm ERR!     at TLSSocket.socketErrorListener (_http_client.js:475:9)
272.2 npm ERR!     at TLSSocket.emit (events.js:400:28)
272.2 npm ERR!     at emitErrorNT (internal/streams/destroy.js:106:8)
272.2 npm ERR!     at emitErrorCloseNT (internal/streams/destroy.js:74:3)
272.2 npm ERR!     at processTicksAndRejections (internal/process/task_queues.js:82:21)
272.2 npm ERR!  FetchError: request to https://registry.npmjs.org/body-parser failed, reason: connect ECONNREFUSED 104.16.1.35:443

Dockerfile:7
--------------------
   5 |     COPY package.json .
   6 |
   7 | >>> RUN npm install
   8 |
   9 |     COPY . .
--------------------
ERROR: failed to solve: process "/bin/sh -c npm install" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/o5g052hkqq4axjji7ttohx1xb

 

 

npm install 시에 너무 오래 걸리고 자꾸 지속적인 에러가 나는 경우에는 alpine 확인을 해 봐야 한다.

FROM node:14-alpine

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

EXPOSE 8080

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

 

FROM 의 apline 을 없애고 node 버전을 써 주면 됨,,,

FROM node:20.17 AS build

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

EXPOSE 8080

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

 

 

#CASE2. npm error code ETIMEDOUT

==> 핸드폰 핫스팟 와이파이 네트워크 이용하고 있었는데.. 귀신같이 아네....

속도가 즈질인가.....................................................

 

랜선 네트워크 연결해서 해보시길..

 

 > [4/6] RUN npm install:
289.4 npm error code ETIMEDOUT
289.4 npm error errno ETIMEDOUT
289.4 npm error network request to https://registry.npmjs.org/body-parser failed, reason:
289.4 npm error network This is a problem related to network connectivity.
289.4 npm error network In most cases you are behind a proxy or have bad network settings.
289.4 npm error network
289.4 npm error network If you are behind a proxy, please make sure that the
289.4 npm error network 'proxy' config is set properly.  See: 'npm help config'

 

 

 

'Docker' 카테고리의 다른 글

[Docker] Dockerfile 문법 , Docker CLI  (0) 2024.05.28