5

I'm getting this error specifically on RUN npm install on Dockerfile:

> core-js@2.6.11 postinstall /app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

The command '/bin/sh -c npm install' returned a non-zero code: 1

When I checked the package dependencies tree via npm ll, I saw that core-js is used by loopbackjs. I'm using version loopback 3.0.0.

I already tried the workaround here and here which is to put this before npm install:

RUN npm config set unsafe-perm true

but same result.

Here's the complete related error log:

Step 6/9 : RUN npm install
 ---> Running in 10ca507be4fa
npm WARN deprecated nsp@2.8.1: The Node Security Platform service is shutting down 9/30 - https://blog.npmjs.org/post/175511531085/the-node-security-platform-service-is-shutting
npm WARN deprecated joi@6.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated wreck@6.3.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated swagger-ui@2.2.10: No longer maintained, please upgrade to swagger-ui@3.
npm WARN deprecated topo@1.1.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

> core-js@2.6.11 postinstall /app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


The command '/bin/sh -c npm install' returned a non-zero code: 1

Here's my package.json:

{
...
"dependencies": {
    "axios": "^0.18.0",
    "body-parser": "^1.18.2",
    "calc-js": "^1.3.0",
    "compression": "^1.0.3",
    "connect-ensure-login": "^0.1.1",
    "cors": "^2.5.2",
    "crypto-js": "^3.1.9-1",
    "csv-parse": "^2.2.0",
    "csvjson": "^5.1.0",
    "email-validator": "^1.1.1",
    "express-flash": "0.0.2",
    "express-jwt": "^5.3.0",
    "file-system": "^2.2.2",
    "helmet": "^1.3.0",
    "js-big-decimal": "^1.2.1",
    "json2csv": "^4.5.4",
    "jsonwebtoken": "^8.1.1",
    "lodash": "^4.17.15",
    "loopback": "^3.0.0",
    "loopback-boot": "^2.6.5",
    "loopback-component-explorer": "^5.0.0",
    "loopback-component-passport": "^3.4.1",
    "loopback-component-storage": "^3.3.1",
    "loopback-connector-mysql": "^2.4.1",
    "loopback-context": "^3.3.0",
    "loopback-ds-timestamp-mixin": "^3.4.1",
    "moment-timezone": "^0.5.20",
    "passport": "^0.4.0",
    "passport-facebook": "^2.1.1",
    "passport-google-oauth": "^1.0.0",
    "passport-local": "^1.0.0",
    "pino": "^4.10.4",
    "pino-pretty": "^3.2.2",
    "safe-compare": "^1.1.2",
    "serve-favicon": "^2.0.1",
    "shortid": "^2.2.8",
    "sqlstring": "^2.3.1",
    "strong-error-handler": "^2.0.0",
    "underscore": "^1.8.3",
    "uuid": "^3.2.1"
  },
  "devDependencies": {
    "eslint": "^3.17.1",
    "eslint-config-loopback": "^8.0.0",
    "nsp": "^2.1.0"
  },
...
}

Here's the Dockerfile (some confidential parts replaced w/ ---):

FROM node:8.11.2-alpine

# Create app directory
RUN mkdir -p /app && ---
WORKDIR /app

# Install app dependencies
RUN apk update && apk upgrade && apk add libc6-compat && apk add curl && apk add bash && rm -rf /var/cache/apk/*
COPY package.json ./
RUN npm install

# Bundle app source
COPY . ./

EXPOSE 9003
CMD [ "npm", "start" ]

Thanks for all the help :)

Mon
  • 1,010
  • 1
  • 11
  • 19
  • worked for me, can you try with `docker build --no-cache -t myimage .` – Adiii Dec 18 '19 at 09:26
  • 1
    What out platform do you use? I do get this error on a Ubuntu host but not on my macOS machine (same Dockerfile) – Ties Apr 03 '20 at 23:15

0 Answers0