【问题标题】:`npm start` in docker ends with: Please install a supported C++11 compiler and reinstall the moduledocker 中的 `npm start` 以: Please install a supported C++11 compiler and reinstall the module 结尾
【发布时间】:2017-10-31 16:53:34
【问题描述】:

我在运行 docket 容器时遇到问题,出现错误:

error: uncaughtException: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.

这是完整的堆栈跟踪:http://pastebin.com/qV0hzRxL

这是我的 Dockerfile:

FROM node:6.7-slim

# ----- I added this, but it didn't help
RUN apt-get update && apt-get install -y gcc g++
RUN gcc --version
RUN g++ --version
# ------------------------------------

WORKDIR /usr/src/app

ENV NODE_ENV docker

RUN npm install
CMD ["npm", "start"]
  • 然后我成功构建它:sudo docker-compose build --no-cache chat-wschat-ws 是图像名称)
  • sudo docker-compose up chat-ws 以错误结尾。

注意:Docker 镜像是 docker-compose 中组合的一部分。


编辑: 部分docker-compose.yml
chat-ws:
  build: ./dockerfiles/chat-ws
  links:
    - redis
    - chat-api
  ports:
    - 3000:3000
  volumes_from:
    - data_chat-ws


和:
data_chat-ws:
  image: node:6.7-slim
  volumes:
    - ${PATH_CHAT_WS}:/usr/src/app
  command: "true"

有什么想法吗?请? 谢谢,彼得

【问题讨论】:

    标签: c++11 docker npm docker-compose


    【解决方案1】:

    对我来说,问题是我的 darwin 版本是 57 (OSX 10.12.6)

    npm install uws # 对我来说是 uws@8.14.1,它有我的 darwin 版本

    现在将编译后的版本复制到您的操作系统

    cp node_modules/uws/uws_darwin_57.node node_modules/socketcluster-server/node_modules/uws/

    【讨论】:

      【解决方案2】:

      已经很晚了,我今天才真正了解docker-compose和Stack Overflow,如果我在这里犯了一些非常明显的错误,请原谅我,但是:

      • 您是否尝试过运行您制作的映像? docker run yourimage,包括任何命令。运行正常吗?
      • 在您的docker-compose 中,为什么您的data_chat-ws 服务具有node:6.7-slim 的图像?那不应该是您构建的图像,即image: chat-ws吗?

      这是我要开始调试的地方:首先确保您确实能够运行映像,将所有docker-compose 的东西放在一边,只有当它运行良好时,才将其添加到您的docker-compose.yml。为了帮助检查您是否可以实际运行您的容器,请查看官方文档here 中的示例(向下滚动到页面的“如何使用此图像”部分)。

      【讨论】:

      • 谢谢,我意识到那里缺少docker-compose.yml 的部分内容,我已将其添加到行之间并标记为EDIT
      猜你喜欢
      • 2018-10-23
      • 2018-07-07
      • 2016-11-02
      • 1970-01-01
      • 2019-09-29
      • 2018-10-27
      • 1970-01-01
      • 2016-02-29
      • 1970-01-01
      相关资源
      最近更新 更多