Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm-bcrypt :: Error: Could not locate the bindings file #51

Closed
TomFreudenberg opened this issue Jun 20, 2016 · 21 comments
Closed

npm-bcrypt :: Error: Could not locate the bindings file #51

TomFreudenberg opened this issue Jun 20, 2016 · 21 comments

Comments

@TomFreudenberg
Copy link
Member

When trying to run official meteor simple-todos-react with new release-1.3.3.1-universal you will receive following attacheed errors.

Already checked that there are currently a number of similar question around without a solution.

W20160620-20:46:15.781(0)? (STDERR)
W20160620-20:46:16.347(0)? (STDERR) /home/meteor/meteor-1.3.3.1-universal/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20160620-20:46:16.350(0)? (STDERR)                             throw(ex);
W20160620-20:46:16.351(0)? (STDERR)                                   ^
W20160620-20:46:16.376(0)? (STDERR) Error: Could not locate the bindings file. Tried:
W20160620-20:46:16.377(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/build/bcrypt_lib.node
W20160620-20:46:16.379(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/build/Debug/bcrypt_lib.node
W20160620-20:46:16.381(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/build/Release/bcrypt_lib.node
W20160620-20:46:16.383(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/out/Debug/bcrypt_lib.node
W20160620-20:46:16.384(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/Debug/bcrypt_lib.node
W20160620-20:46:16.386(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/out/Release/bcrypt_lib.node
W20160620-20:46:16.387(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/Release/bcrypt_lib.node
W20160620-20:46:16.389(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/build/default/bcrypt_lib.node
W20160620-20:46:16.390(0)? (STDERR)  → /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/compiled/0.10.45/linux/arm/bcrypt_lib.node
W20160620-20:46:16.392(0)? (STDERR)     at bindings (/home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/node_modules/bindings/bindings.js:88:9)
W20160620-20:46:16.393(0)? (STDERR)     at Object. (/home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt/bcrypt.js:3:35)
W20160620-20:46:16.395(0)? (STDERR)     at Module._compile (module.js:456:26)
W20160620-20:46:16.396(0)? (STDERR)     at Object.Module._extensions..js (module.js:474:10)
W20160620-20:46:16.398(0)? (STDERR)     at Module.load (module.js:356:32)
W20160620-20:46:16.399(0)? (STDERR)     at Module.Mp.load (/home/meteor/simple-todos-react/.meteor/local/isopacks/babel-compiler/npm/node_modules/meteor-babel/node_modules/reify/node/runtime.js:16:23)
W20160620-20:46:16.401(0)? (STDERR)     at Function.Module._load (module.js:312:12)
W20160620-20:46:16.403(0)? (STDERR)     at Module.require (module.js:364:17)
W20160620-20:46:16.404(0)? (STDERR)     at require (module.js:380:17)
W20160620-20:46:16.435(0)? (STDERR)     at Object.Npm.require (/home/meteor/simple-todos-react/.meteor/local/build/programs/server/boot.js:190:18)
@TomFreudenberg
Copy link
Member Author

I already have tried to replace the node/npm version with v0.10.43 from nodejs.org as well as from meteors/node.

Not sure what is the problem yet. Any help and idea is welcome.

@TPXP any idea?

@TomFreudenberg
Copy link
Member Author

How to reconstruct this issue:

cd $HOME

meteor create sample

cd sample

meteor add npm-bcrypt

meteor run

@TPXP
Copy link

TPXP commented Jun 21, 2016

It seems that Node cannot locate bcrypt bindings, maybe because they were not built. By any chance, have you moved packages/non-core/npm-bcrypt to packages/bcrypt ? Meteor should then build bcrypt for your architecture via npm, which will hopefully solve the bug.

Or just go to /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/ and npm install bcrypt, which will build it as well.

@TomFreudenberg
Copy link
Member Author

TomFreudenberg commented Jun 21, 2016

Hi Thomas, thanks for feedback.

Both step were done already even that I had solved this type of problem long time ago when applying this lines of code to solve the non-core packages problem.

@TomFreudenberg
Copy link
Member Author

So by now, I now how to solve that issue but not why it is not handled automatically?

In the above error example, just go into:

cd /home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/.npm/package/node_modules/bcrypt

node-gyp rebuild

the node-gyp can be located at meteor dev_bundle/lib/node_modules/npm/bin/node-gyp-bin/node-gyp

be aware to also set PATH for the dev_bundle/bin to have node in the search path.

I guess it depends on that meteor has decoupled node from the dev_bundle but I have reinvest that for ARM support. Have to check it out there

@TomFreudenberg
Copy link
Member Author

Ok, issue is also solved in any case if you run node-gyp rebuild inside the non-core/npm-bcrypt folder.

After that every app will get that rebuild.

To make sure that your app will be rebuilded too, run once meteor reset

@TomFreudenberg
Copy link
Member Author

Question still left: why isn't this done automatically during first time compile of packages like npm-bcrypt?

@TomFreudenberg
Copy link
Member Author

Ok, got the difference!

When running

meteor npm install bcrypt@0.8.6

inside the non-core/npm-bcrypt package, it will do following

meteor npm install bcrypt@0.8.6
npm WARN cannot run in wd bcrypt@0.8.6 node-gyp rebuild (wd=/home/meteor/meteor-1.3.3.1-universal/packages/non-core/npm-bcrypt/node_modules/bcrypt)
bcrypt@0.8.6 node_modules/bcrypt
├── bindings@1.2.1
└── nan@2.2.1

Important is npm WARN cannot run in wd

If renaming this folder or doing same somewhere else in the linux system, the output is:

> bcrypt@0.8.6 install /home/meteor/meteor-1.3.3.1-universal/packages/non-core/node_modules/bcrypt
> node-gyp rebuild
make: Entering directory `/home/meteor/meteor-1.3.3.1-universal/packages/non-core/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
  SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
  COPY Release/bcrypt_lib.node
make: Leaving directory `/home/meteor/meteor-1.3.3.1-universal/packages/non-core/node_modules/bcrypt/build'
bcrypt@0.8.6 node_modules/bcrypt
├── bindings@1.2.1
└── nan@2.2.1

Now to find the reason for that exception

@TomFreudenberg
Copy link
Member Author

TomFreudenberg commented Jun 21, 2016

This error depends on ARM npm 2.15.? (I build, tested and run into error with 2.15.1 and 2.15.8)

When using npm@3.9.6 everything is running fine.

The problem occurs only if the string bcrypt is part of the directory you wish to run npm install in, like:

npm-bcrypt or bcrypt or also xxxbcryptyyy

Amazing.

I made all the same tests on Ubuntu x86 achitecture with no issue.

Amazing 2.

After googling the issues:

npm/npm#3497
nodejs/docker-iojs#72
npm/npm#8862

I tried to use npm install --unsafe-perm bcrypt@0.8.6 and that worked ???

Now looking what that mean???

Any help is welcome

@TomFreudenberg
Copy link
Member Author

Ok, @codvio decribed what happens through directory names:

npm/npm#8862 (comment)

I will check if I implement the patch in the binary builts - other wise I have to include npm@3 instead of npm@2?

No idea whats happen on npm@3 - seems to be the easiest / best to patch the npm.

@TPXP - any suggestion to that ?

@TomFreudenberg
Copy link
Member Author

TomFreudenberg commented Jun 21, 2016

Looking at current master from NPM they changed the parts @codvio mentioned:

https://github.com/npm/npm/blob/master/lib/utils/lifecycle.js#L63-L64
https://github.com/npm/npm/blob/master/lib/utils/lifecycle.js#L85-L87

So this is possible the best to take as a patch for 2.15.1 included here

@TomFreudenberg
Copy link
Member Author

This part of npm is include into node sources, so I will run a fork of node just to patch that part of npm for the meteor fork

@TPXP
Copy link

TPXP commented Jun 21, 2016

Well, the meteor team probably does not have this issue as they provide prebuilt npm-bcrypt packages.

This issue is strange, I didn't experience it when I had to use the npm-bcrypt package as a dependency of accounts-base package, (and I'm pretty sure meteor rebuilt the package, as it was not built), despite the fact that NodeJSv4 ships with NPM v2.15.1. Maybe the things are different when you add a package as a dependency ?

Anyway, I don't think that we should bundle NPMv3 with this project, as even the official NodeJSv4 binary ships with NPMv2. So your patching solution seems to be the most elegant to me.

@TomFreudenberg
Copy link
Member Author

TomFreudenberg commented Jun 21, 2016

@TPXP I can reproduce this problem without any interaction of meteor. Maybe you can try this as well.

cd /tmp
mkdir simple-bcrypt
cd simple-bcrypt
npm install bcrypt@0.8.6

When you run this on your ARM board, it should show that "WD Warning" and will not run node-gyp

If you name the folder /tmp/foo everything works with build.

Same to you?

@TPXP
Copy link

TPXP commented Jun 21, 2016

Strange, I don't have this problem, the commands you gave above work correctly on my board. 😕

Maybe it's a filesystem-related issue ? I'm using ext4 in case it helps.

@TomFreudenberg
Copy link
Member Author

Hm ... please check the lifecycle.js file on you system. Best to be sure that not a different npm goes between just run a global

find / -name 'lifecycle.js'

and check for the marked lines from above.

@TomFreudenberg
Copy link
Member Author

Done!

@TPXP
Copy link

TPXP commented Jun 22, 2016

I guess meteor calls my system's NPMv3 instead of the one in the dev bundle. Anyway, good work for fixing this bug. 😄

@TomFreudenberg
Copy link
Member Author

Well thats good news :-) so the work seems to be usefull

@TomFreudenberg
Copy link
Member Author

With changes to 1.3.4.1 also npm was adjusted to npm@3 so this fix is not necessary anymore.

I dropped the branch for 1.3.3.1 as well as the patched node fork.

I do not want to be away too much from defaults an third party projects.

Please use 1.3.4.1 which is now fully functional

@TomFreudenberg
Copy link
Member Author

Just for knowledge the fix from the forked repo as a screenshot

bildschirmfoto 2016-06-30 um 00 02 22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants