错误:在docker容器中找不到模块“fiber / future”

时间:2017-09-28 04:11:58

标签: docker meteor

Meteor项目在本地计算机上运行正常并且用于在EC2 docker容器上正常工作,但由于某种原因,它现在失败了,这是我从EC2中找到的:

 docker logs be664c9bce8a
/opt/bundle/programs/server/boot.js:392
}).run();
   ^

Error: Cannot find module "fibers/future"
    at Object.require (/opt/bundle/programs/server/boot.js:232:24)
    at packages/meteor.js:93:20
    at packages/meteor.js:263:4
    at packages/meteor.js:1392:3
    at /opt/bundle/programs/server/boot.js:339:34
    at Function._.each._.forEach (/opt/bundle/node_modules/underscore/underscore.js:153:9)
    at /opt/bundle/programs/server/boot.js:158:5
    at /opt/bundle/programs/server/boot.js:388:5
    at Function.run (/opt/bundle/programs/server/profile.js:510:12)
    at /opt/bundle/programs/server/boot.js:387:11

这是docker文件:

FROM lambdalinux/baseimage-amzn
#RUN yum update -y
RUN curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
RUN yum install -y tar nodejs gcc-c++ make

ADD ./novice-driver.tar.gz /opt/

EXPOSE 8000

ENV ROOT_URL https://novicedriver.com.au
ENV MONGO_URL "mongodb://abc:xyz@cluster0...sDB?ssl=true&replicaSet=Cluster0-shard-0&authSource=myDB"
ENV PORT 8000

WORKDIR /opt/bundle/
RUN npm install fibers underscore source-map-support semver

CMD node ./main.js

有关如何解决此问题的任何建议?感谢

1 个答案:

答案 0 :(得分:1)

在Docker容器中,您应首先为您的软件包安装npm个模块:

# Install node modules
WORKDIR /opt/bundle/programs/server
RUN npm install

WORKDIR /opt/bundle
# do you other stuff

此外,在构建应用包之前(在本地计算机或CI服务器上),最好使用:meteor npm install --production而不仅仅是npm install --production