Meteor run server getting error: “Could not locate the bindings file. […]bcrypt[…]”

断了今生、忘了曾经 提交于 2019-12-11 06:58:46

问题


Problem

I try to run a Meteor server application in a Docker image. Running the main file to start the server results in an error, see details below: Could not locate the bindings file. (My system: Macbook Pro, OSX 10.11.4)

Question

Has anybody an idea how to solve this error?

Unsuccessful attempts to solve the problem

  1. Running npm rebuild as proposed here didn't work
  2. Proposal by Nick Bull: Running npm install --unsafe-perm node-gyp and npm install --unsafe-perm libxmljs didn't work. Both executed in the docker container in /home/build/bundle/programs/server. (The --unsafe-perm flag is needed due to root rights in docker image)

Details

  1. The Dockerfile (inspired by meteorhacks/meteord)
FROM debian:wheezy

ENV sourcedir /home/source
ENV builddir /home/build
RUN mkdir ${sourcedir} && mkdir ${builddir}

RUN apt-get update -y
RUN apt-get install -y curl bzip2 build-essential python git

RUN \
    NODE_VERSION=4.4.7 \
    && NODE_ARCH=x64 \
    && NODE_DIST=node-v${NODE_VERSION}-linux-${NODE_ARCH} \
    && cd /tmp \
    && curl -O -L http://nodejs.org/dist/v${NODE_VERSION}/${NODE_DIST}.tar.gz \
    && tar xvzf ${NODE_DIST}.tar.gz \
    && rm -rf /opt/nodejs \
    && mv ${NODE_DIST} /opt/nodejs \
    && ln -sf /opt/nodejs/bin/node /usr/bin/node \
    && ln -sf /opt/nodejs/bin/npm /usr/bin/npm

RUN curl -sL https://install.meteor.com | sed s/--progress-bar/-sL/g | /bin/sh

ADD . ${sourcedir}
RUN cd ${sourcedir} \
    && meteor build  --directory ${builddir} --server=http://localhost:3000

RUN cd ${builddir}/bundle/programs/server/ && npm install
  1. The Error message, when running node main.js in the bundle folder:
/home/build/bundle/programs/server/node_modules/fibers/future.js:280
                        throw(ex);
                        ^

Error: Could not locate the bindings file. Tried:
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/build/bcrypt_lib.node
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/build/Debug/bcrypt_lib.node
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/out/Debug/bcrypt_lib.node
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/Debug/bcrypt_lib.node
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/out/Release/bcrypt_lib.node
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/Release/bcrypt_lib.node
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/build/default/bcrypt_lib.node
 → /home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/compiled/4.4.7/linux/x64/bcrypt_lib.node
    at bindings (/home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bindings/bindings.js:88:9)
    at Object.<anonymous> (/home/build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/bcrypt.js:3:35)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Module.Mp.load (/home/build/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/reify/node/runtime.js:16:23)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.Npm.require (/home/build/bundle/programs/server/boot.js:190:18)

回答1:


According to many online sources, it's a bug in node-gyp. Try this:

npm install node-gyp
npm install libxmljs

and see what happens.




回答2:


Okay I found the bug: The problem was the definition of the envrionment varibale buildir in the Dockerfile: ENV builddir /home/build The build process for bcrypt seems to use the same variable, and builds the files bcrypt_lib.node and obj.target in that directory. So they were missing in the right place.




回答3:


If you're in censored country like Kazakhstan then running meteor through vpn the first time will help, since it fails at downloading gyp plugins. There should be a line somewhere about download failing, not when you run meteor start specifically.



来源:https://stackoverflow.com/questions/38808841/meteor-run-server-getting-error-could-not-locate-the-bindings-file-bcryp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!