[CentOS-devel] npm install issue in docker CE using Cent OS 8

Mon Feb 10 06:42:47 UTC 2020
Amey Abhyankar <sco1984 at gmail.com>

Hello,

I am trying to run a Dockerfile with 'npm install' but getting errors.
Version details as follows =

Cent OS version: 8
Docker CE version: 19.03.4
Dockerfile:

-------------------------------------
# Create image based on the official Node 10 image from dockerhub
FROM node:10.16.3

# Create a directory where our app will be placed
RUN mkdir -p /app

# Change directory so that our commands run inside this new directory
WORKDIR /app

# Copy dependency definitions
COPY package*.json /app/

# Install dependecies
RUN npm cache clear --force
RUN npm install -verbose

# Get all the code needed to run the app
COPY . /app/

# Expose the port the app runs in
EXPOSE 4200

# Serve the app
CMD ["npm", "start"]

-------------------------------------

Error:

-------------------------------------

Step 6/9 : RUN npm install -verbose
 ---> Running in f6cf6cf24712
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   '-verbose' ]
npm info using npm at 6.9.0
npm info using node at v10.16.3
npm verb npm-session 8c25dbc16da110c3
npm info lifecycle app01-uiapp at 0.0.0~preinstall: app01-uiapp at 0.0.0
npm timing stage:loadCurrentTree Completed in 20ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1768ms
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 2534ms
npm timing stage:loadIdealTree Completed in 5336ms
npm timing stage:generateActionsToTake Completed in 1623ms
npm verb correctMkdir /root/.npm/_locks correctMkdir not in flight; initializing
npm verb makeDirectory /root/.npm/_locks creation not in flight; initializing
npm verb lock using /root/.npm/_locks/staging-bd3355550c5a469e.lock
for /app/node_modules/.staging
npm timing action:extract Completed in 315443ms
npm verb unlock done using
/root/.npm/_locks/staging-bd3355550c5a469e.lock for
/app/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 3ms
npm timing stage:runTopLevelLifecycles Completed in 323677ms
npm verb type system
npm verb stack FetchError: request to
https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz failed, reason:
getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
npm verb stack     at ClientRequest.req.on.err
(/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
npm verb stack     at ClientRequest.emit (events.js:198:13)
npm verb stack     at TLSSocket.socketErrorListener (_http_client.js:392:9)
npm verb stack     at TLSSocket.emit (events.js:198:13)
npm verb stack     at emitErrorNT (internal/streams/destroy.js:91:8)
npm verb stack     at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
npm verb stack     at process._tickCallback
(internal/process/next_tick.js:63:19)
npm verb cwd /app
npm verb Linux 4.18.0-80.11.2.el8_0.x86_64
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-verbose"
npm verb node v10.16.3
npm verb npm  v6.9.0
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to
https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz failed, reason:
getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
npm verb exit [ 1, true ]
npm timing npm Completed in 624434ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-02-10T04_26_38_115Z-debug.log
The command '/bin/sh -c npm install -verbose' returned a non-zero code: 1

-------------------------------------

Other details: I can ping/wget the tgz file from base Cent OS 8
machine that means it's not the DNS issue.

Any hints how to fix this issue? Thanks.

Regards,
Amey.