【问题标题】:Dockerhub automated build failing due to npm install bcrypt issue由于 npm install bcrypt 问题,Dockerhub 自动构建失败
【发布时间】:2015-01-12 08:27:18
【问题描述】:

我有一个看起来像这样的Dockerfile

FROM ubuntu:14.04
MAINTAINER Firstname Lastname <email@myapp.com>

ENV NODE_ENV production
ENV PORT 3333

RUN apt-get update && apt-get install -y git nodejs npm htop

RUN mkdir /root/.ssh/ && \
    touch /root/.ssh/known_hosts && \
    ssh-keyscan github.com >> /root/.ssh/known_hosts

ADD .ssh/my-github-deploy-key /root/.ssh/my-github-deploy-key
ADD .ssh/config /root/.ssh/config

RUN chmod 600 /root/.ssh/my-github-deploy-key && \
    chmod 600 /root/.ssh/config && \
    chown -R root:root /root/.ssh

RUN mkdir /srv/MyAppName && \
    cd /srv && \
    git clone git@github.com:MyAccountName/MyAppName.git MyAppName && \
    cd MyAppName && \
    npm install

EXPOSE 3333

CMD ["nodejs","/srv/MyAppName/index.js"]

我已经将我的Dockerhub 存储库连接到我的Github 存储库,这样每次我推送到我的主分支时都会触发一个Automated Build

但是构建失败了,这可能是由于npm install bcrypt 命令造成的。我在构建日志中收到以下错误:

gyp: Call to 'node -e "require('nan')"' returned exit status 127. while trying to load binding.gyp
Error: `gyp` failed with exit code: 1 at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
ERR! at ChildProcess.EventEmitter.emit (events.js:98:17)
ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
ERR! System Linux 3.14.27
ERR!command "nodejs" "/usr/bin/node-gyp" "rebuild"
ERR! cwd /srv/MyApp/node_modules/bcrypt
ERR! node -v v0.10.25
ERR! node-gyp -v v0.10.10
ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"

我不知道为什么这是legacy binary node 问题,因为我正在安装最新版本。

我该如何解决这个问题?

【问题讨论】:

    标签: node.js bcrypt dockerhub


    【解决方案1】:

    想通了。 一个 nodejs 遗留问题。需要像这样添加Debian nodejs-legacy symlink package

    RUN apt-get update && apt-get install -y git nodejs npm htop nodejs-legacy
    

    然后构建运行没有问题。

    【讨论】:

      猜你喜欢
      • 2022-11-01
      • 1970-01-01
      • 2020-11-05
      • 2021-05-08
      • 2017-11-11
      • 2023-03-05
      • 2022-08-11
      • 1970-01-01
      • 2015-02-24
      相关资源
      最近更新 更多