代码之家  ›  专栏  ›  技术社区  ›  user606521

在全局安装包时,为什么npm安装在ArmV7 docker映像中失败?

  •  1
  • user606521  · 技术社区  · 6 年前

    FROM arm32v7/node:8
    RUN npm --version
    RUN npm install -g yarn
    

    下面是输出日志:

    Sending build context to Docker daemon  65.25MB
    Step 1/5 : FROM arm32v7/node:8
     ---> 1e66bc1fab80
    Step 2/5 : RUN npm --version
     ---> Running in c62ffb8ecc56
    Unknown host QEMU_IFLA type: 40
    Unknown host QEMU_IFLA type: 41
    Unknown host QEMU_IFLA type: 40
    Unknown host QEMU_IFLA type: 41
    Unknown QEMU_IFLA_INFO_KIND ipip
    Unknown host QEMU_IFLA type: 40
    Unknown host QEMU_IFLA type: 41
    Unknown QEMU_IFLA_INFO_KIND ip6tnl
    Unknown host QEMU_IFLA type: 40
    Unknown host QEMU_IFLA type: 41
    6.4.1
    Removing intermediate container c62ffb8ecc56
     ---> 69f0396a3742
    Step 3/5 : RUN npm install -g yarn
     ---> Running in d173b95e284c
    Unknown host QEMU_IFLA type: 40
    Unknown host QEMU_IFLA type: 41
    Unknown host QEMU_IFLA type: 40
    Unknown host QEMU_IFLA type: 41
    Unknown QEMU_IFLA_INFO_KIND ipip
    Unknown host QEMU_IFLA type: 40
    Unknown host QEMU_IFLA type: 41
    Unknown QEMU_IFLA_INFO_KIND ip6tnl
    Unknown host QEMU_IFLA type: 40
    Unknown host QEMU_IFLA type: 41
    Error: could not get uid/gid
    [ 'nobody', 0 ]
    
        at /usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js:37:16
        at ChildProcess.exithandler (child_process.js:283:5)
        at emitTwo (events.js:126:13)
        at ChildProcess.emit (events.js:214:7)
        at maybeClose (internal/child_process.js:915:16)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    TypeError: Cannot read property 'get' of undefined
        at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
        at /usr/local/lib/node_modules/npm/bin/npm-cli.js:78:20
        at cb (/usr/local/lib/node_modules/npm/lib/npm.js:228:22)
        at /usr/local/lib/node_modules/npm/lib/npm.js:266:24
        at /usr/local/lib/node_modules/npm/lib/config/core.js:83:7
        at Array.forEach (<anonymous>)
        at /usr/local/lib/node_modules/npm/lib/config/core.js:82:13
        at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
        at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:173:20)
        at Conf.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/core.js:231:22)
    /usr/local/lib/node_modules/npm/lib/utils/error-handler.js:205
      if (npm.config.get('json')) {
                     ^
    
    TypeError: Cannot read property 'get' of undefined
        at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
        at emitOne (events.js:116:13)
        at process.emit (events.js:211:7)
        at process._fatalException (bootstrap_node.js:391:26)
    The command '/bin/sh -c npm install -g yarn' returned a non-zero code: 7
    

    你知道为什么会失败吗?我用commad建立形象 docker build . -t myimage (我在Mac OS X上运行docker)。


    安装无“-g”标志的纱线时,请不要确认其工作正常。

    0 回复  |  直到 6 年前