Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 尝试在Docker上运行依赖项核心js时出现NPM postinstall错误_Node.js_Docker_Npm_Loopbackjs_Core Js - Fatal编程技术网

Node.js 尝试在Docker上运行依赖项核心js时出现NPM postinstall错误

Node.js 尝试在Docker上运行依赖项核心js时出现NPM postinstall错误,node.js,docker,npm,loopbackjs,core-js,Node.js,Docker,Npm,Loopbackjs,Core Js,我在Dockerfile上运行npm安装时特别遇到此错误: > 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 当我通过npm ll检查包依赖关系树时,我看到核心js被loopbackjs使用

我在
Dockerfile
上运行npm安装时特别遇到此错误:

> 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
当我通过
npm ll
检查包依赖关系树时,我看到核心js被loopbackjs使用。我正在使用版本
环回3.0.0

我已经尝试了解决方法,将其放在npm安装之前:

RUN npm config set unsafe-perm true
但同样的结果

以下是完整的相关错误日志:

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
这是
Dockerfile
(一些机密部分被替换为w/
--
):

来自节点:8.11.2-1
#创建应用程序目录
运行mkdir-p/app&&---
WORKDIR/app
#安装应用程序依赖项
运行apk update&&apk upgrade&&apk add libc6 compat&&apk add curl&&apk add bash&&rm-rf/var/cache/apk/*
复制package.json/
运行npm安装
#捆绑应用程序源
复制/
曝光9003
CMD[“npm”,“开始”]

感谢所有的帮助:)

对我很有用,你能试试docker build--no cache-t myimage吗。你使用什么样的out平台?我确实在Ubuntu主机上收到这个错误,但在macOS机器上没有(相同的Dockerfile)
{
...
"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"
  },
...
}