在docker容器中运行npm install时出错

时间:2017-07-12 06:22:21

标签: node.js ubuntu docker dockerfile

尝试在我的docker容器中运行npm install。但我得到的只是:

pm WARN package.json yeti-ui@0.0.0 No repository field.
npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: fsevents@1.1.1
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

npm ERR! System Linux 4.9.31-moby
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/chrome
npm ERR! node -v v4.8.3
npm ERR! npm -v 1.4.21
npm ERR! code EBADPLATFORM
npm WARN prefer global marked@0.3.6 should

这就是我的码头图片的样子(我正在汲取预建的灵感:

FROM debian:sid
LABEL name="chrome-headless" \ 
        maintainer="Justin Ribeiro <justin@justinribeiro.com>" \
        version="1.4" \
        description="Google Chrome Headless in a container"

RUN apt-get update && apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
  gnupg \
    --no-install-recommends \
    && curl -sSL https://dl.google.com/linux/linux_signing_key.pub |     apt-key add - \
    && echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/     stable main" > /etc/apt/sources.list.d/google-chrome.list \
    && apt-get update && apt-get install -y \
    google-chrome-stable \
    --no-install-recommends \
    && apt-get purge --auto-remove -y curl gnupg \
    && rm -rf /var/lib/apt/lists/*
    RUN apt-get update && apt-get install -y nodejs npm git
    RUN ln -s /usr/bin/nodejs /usr/bin/node

    RUN groupadd -r chrome && useradd -r -g chrome -G audio,video chrome \
    && mkdir -p /home/chrome && chown -R chrome:chrome /home/chrome

USER chrome
WORKDIR /home/chrome
ADD .npmrc .npmrc
ADD package.json package.json
COPY . .
# RUN npm install (I have commented this out because the image could not be built for the same reason, so I thought it was easier to debug it if I manually try to run npm install when the container is up and running.)

我找到了一些论坛,声明可以通过更新npm来解决。我尝试使用此命令将npm更新为最新版本npm install npm install npm @ latest,即使安装了最新版本,它似乎也没有使用最新版本。

0 个答案:

没有答案