添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

In my package.json I have this line "bcrypt": "~0.7.7" under the dependencies. When I install my app simply via npm install then the app crashes while running grunt tests with:

Mocha exploded!
Error: Could not load the bindings file. Tried:
.../xxx/node_modules/bcrypt/build/bcrypt_lib.node
.../xxx/node_modules/bcrypt/build/Debug/bcrypt_lib.node
.../xxx/node_modules/bcrypt/build/Release/bcrypt_lib.node
.../xxx/node_modules/bcrypt/out/Debug/bcrypt_lib.node
.../xxx/node_modules/bcrypt/Debug/bcrypt_lib.node
.../xxx/node_modules/bcrypt/out/Release/bcrypt_lib.node
.../xxx/node_modules/bcrypt/Release/bcrypt_lib.node
.../xxx/node_modules/bcrypt/build/default/bcrypt_lib.node
.../xxx/node_modules/bcrypt/compiled/0.10.22/darwin/x64/bcrypt_lib.node
.../xxx/node_modules/bcrypt/node_modules/bindings/bindings.js:84:13)
.../xxx/node_modules/bcrypt/bcrypt.js:1:97)

I have to run manually npm install bcrypt again after npm install and then it works. Really weird.

This forces me to add this line in package.json to make it work with npm install :

  "scripts": {
    "start":        "node ./server/server",
    "postinstall":  "npm install bcrypt", // kludge! bad workaround
    "test":         "grunt test"

I know, it's bad. But I have to add this postinstall script so that it won't crash on my server when deployed.

Any clues?

Sounds like there were install errors that are not shown in the log you posted so the fact that tests failed to run makes sense. We need a lot more information about your environment: os, node version, was this a clean install? and most importantly the actual install log with the error. It sounds like your install may have been interrupted by something. I would suggest clearing out node_modules and trying to do a clean install then reporting any error. I am inclined to say this is environment error given that no other instances of this have been reported and this module gets lots of use.

I hear you guys. Just did all that and the problem is still here:

  • I removed all occurrences of ~ in the package.json
  • Wiped out node_modules
  • Ran npm install again
  • No errors happened during install. There is no log.
  • Then ran grunt test and then, boooom, same crash!
  • My env is:

  • Mac OS X 10.9
  • node -v = v0.10.22
  • Really weird.

    Awesome! Thanks for the update!
    On Dec 6, 2013 9:52 PM, "Michael Heuberger" notifications@github.com
    wrote:

    I hear you guys. Just did all that and the problem is still here:

  • I removed all occurrences of ~ in the package.json
  • Wiped out node_modules
  • Ran npm install again
  • No errors happened during install
  • Then ran grunt test and then, boooom, same crash!
  • My env is:

  • Mac OS X 10.9
  • node -v = v0.10.22
  • yes, it was a clean install
  • But wait, I found something ... in my package.json I had this:

    "postinstall": "npm prune && bower install"

    The prune command was a bad idea. It removed the error log after npm
    install! Bad idea of mine.

    Now I see the error log and see that other packages were the culprit, not
    this one. For example zauni/node-pngquant-bin#1zauni/node-pngquant-bin#1

    Anyway, ticket closed for now.

    Reply to this email directly or view it on GitHubhttps://github.com//issues/193#issuecomment-30045996

    Fail. I cannot remove other modules as I need these for the tests.

    Alright. Here is my whole package.json. Do you smell something bad here?

    "name": "xxx", "version": "0.0.15", "private": true, "license": "proprietary", "readmeFilename": "README.md", "scripts": { "start": "node ./server/server", "preinstall": "sudo npm install -g supervisor grunt grunt-cli bower", "postinstall": "npm install bcrypt && npm prune && bower prune && bower install", "preupdate": "sudo npm update -g supervisor grunt grunt-cli bower", "postupdate": "npm prune && bower prune && bower update", "test": "grunt test" "engines": { "node": "~0.10.21", "npm": "~1.3.13" "dependencies": { "express": "3.4.6", "bunyan": "0.21.4", "settings": "0.1.1", "merge-recursive": "0.0.3", "jade": "0.35.0", "gaze": "0.4.3", "nodemailer": "0.5.14", "errormailer": "0.2.1", "slug": "0.4.0", "require-directory": "1.2.0", "avconv": "0.2.6", "node-uuid": "1.4.1", "level-sublevel": "5.1.1", "level": "0.18.0", "level-exists": "0.0.3", "fs.extra": "1.2.1", "once": "1.3.0", "connect-stream": "1.1.2", "passport": "0.1.17", "async": "0.2.9", "bcrypt": "0.7.7", "longjohn": "0.2.2", "passport-facebook": "1.0.2", "passport-google": "0.3.0", "formidable": "1.0.14", "juice": "0.4.0" "devDependencies": { "grunt-contrib-clean": "0.5.0", "grunt-contrib-less": "0.8.3", "grunt-contrib-watch": "0.5.3", "grunt-bk-filerev": "0.1.3", "grunt-filerev-assets": "0.2.0", "grunt-bg-shell": "2.3.1", "grunt-bunyan": "0.4.1", "grunt-contrib-requirejs": "0.4.1", "grunt-mocha-test": "0.8.1", "grunt-env": "0.4.0", "matchdep": "0.3.0", "chai": "1.8.1", "grunt-contrib-copy": "0.4.1", "grunt-contrib-imagemin": "0.4.0", "time-grunt": "0.2.3", "grunt-css-url-rewrite": "0.3.2", "grunt-browser-sync": "0.3.0", "levelweb": "0.4.1-1", "mocha": "1.15.1", "phantomjs": "1.9.2-5", "grunt-mocha-webdriver": "0.9.14", "grunt-contrib-jshint": "0.7.2", "grunt-jsbeautifier": "0.2.3"

    Any clues guys? Thanks!!

    Can you include the full log?
    On Dec 6, 2013 10:42 PM, "Michael Heuberger" notifications@github.com
    wrote:

    Fail. I cannot remove other modules as I need these for the tests.

    Alright. Here is my whole package.json. Do you smell something bad here?

    "name": "xxx",
    "version": "0.0.15",
    "private": true,
    "license": "proprietary",
    "readmeFilename": "README.md",
    "scripts": {
    "start": "node ./server/server",
    "preinstall": "sudo npm install -g supervisor grunt grunt-cli bower",
    "postinstall": "npm install bcrypt && npm prune && bower prune && bower install",
    "preupdate": "sudo npm update -g supervisor grunt grunt-cli bower",
    "postupdate": "npm prune && bower prune && bower update",
    "test": "grunt test"
    "engines": {
    "node": "~0.10.21",
    "npm": "~1.3.13"
    "dependencies": {
    "express": "3.4.6",
    "bunyan": "0.21.4",
    "settings": "0.1.1",
    "merge-recursive": "0.0.3",
    "jade": "0.35.0",
    "gaze": "0.4.3",
    "nodemailer": "0.5.14",
    "errormailer": "0.2.1",
    "slug": "0.4.0",
    "require-directory": "1.2.0",
    "avconv": "0.2.6",
    "node-uuid": "1.4.1",
    "level-sublevel": "5.1.1",
    "level": "0.18.0",
    "level-exists": "0.0.3",
    "fs.extra": "1.2.1",
    "once": "1.3.0",
    "connect-stream": "1.1.2",
    "passport": "0.1.17",
    "async": "0.2.9",
    "bcrypt": "0.7.7",
    "longjohn": "0.2.2",
    "passport-facebook": "1.0.2",
    "passport-google": "0.3.0",
    "formidable": "1.0.14",
    "juice": "0.4.0"
    "devDependencies": {
    "grunt-contrib-clean": "0.5.0",
    "grunt-contrib-less": "0.8.3",
    "grunt-contrib-watch": "0.5.3",
    "grunt-bk-filerev": "0.1.3",
    "grunt-filerev-assets": "0.2.0",
    "grunt-bg-shell": "2.3.1",
    "grunt-bunyan": "0.4.1",
    "grunt-contrib-requirejs": "0.4.1",
    "grunt-mocha-test": "0.8.1",
    "grunt-env": "0.4.0",
    "matchdep": "0.3.0",
    "chai": "1.8.1",
    "grunt-contrib-copy": "0.4.1",
    "grunt-contrib-imagemin": "0.4.0",
    "time-grunt": "0.2.3",
    "grunt-css-url-rewrite": "0.3.2",
    "grunt-browser-sync": "0.3.0",
    "levelweb": "0.4.1-1",
    "mocha": "1.15.1",
    "phantomjs": "1.9.2-5",
    "grunt-mocha-webdriver": "0.9.14",
    "grunt-contrib-jshint": "0.7.2",
    "grunt-jsbeautifier": "0.2.3"

    Any clues guys? Thanks!!

    Reply to this email directly or view it on GitHubhttps://github.com//issues/193#issuecomment-30046850

    No log file is generated when I do a npm install with the above without the postinstall part.

    There is no log, nothing at all. And I still get this:

    Running "mochaTest:server" (mochaTest) task
    >> Mocha exploded!
    >> Error: Could not load the bindings file. Tried:
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/build/bcrypt_lib.node
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/build/Debug/bcrypt_lib.node
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/build/Release/bcrypt_lib.node
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/out/Debug/bcrypt_lib.node
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/Debug/bcrypt_lib.node
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/out/Release/bcrypt_lib.node
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/Release/bcrypt_lib.node
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/build/default/bcrypt_lib.node
    >>  → /Users/mick/projects/xxx/node_modules/bcrypt/compiled/0.10.22/darwin/x64/bcrypt_lib.node
    >>     at bindings (/Users/mick/projects/xxx/node_modules/bcrypt/node_modules/bindings/bindings.js:84:13)
    >>     at Object.<anonymous> (/Users/mick/projects/xxx/node_modules/bcrypt/bcrypt.js:1:97)
    >>     at Module._compile (module.js:456:26)
    >>     at Object.Module._extensions..js (module.js:474:10)
    >>     at Module.load (module.js:356:32)
    >>     at Function.Module._load (module.js:312:12)
    >>     at Module.require (module.js:364:17)
    >>     at require (module.js:380:17)
    >>     at Object.<anonymous> (/Users/mick/projects/xxx/server/lib/models/user.js:4:14)
    >>     at Module._compile (module.js:456:26)
    

    When I manually install npm install bcrypt then it works.

    Why can't it find the bindings file in the first place? What is that file and how it is generated? There is no build, no out, no Debug, no out, no Release, no build and no compiled sub directory in the bcrypt folder.

    Hmmmm ...

    Have you tried removing grunt from the equation to make sure that isn't
    having an affect?
    On Dec 19, 2013 6:44 PM, "Michael Heuberger" notifications@github.com
    wrote:

    Still happening :(

    Reply to this email directly or view it on GitHubhttps://github.com//issues/193#issuecomment-30977763

    No. I mean run your tests outside of grunt. Grunt itself is just a task
    runner so presumably your using something like mocha or nodeunit or
    something else to actually handle the tests right?
    On Dec 19, 2013 7:00 PM, "Michael Heuberger" notifications@github.com
    wrote:

    @ncb000gt https://github.com/ncb000gt I am sorry I do not understand.
    You mean uninstall grunt?

    Reply to this email directly or view it on GitHubhttps://github.com//issues/193#issuecomment-30978587

    So I took a stab at this using your provided package.json and determined the problem is with the following module: grunt-bk-filerev

    Here are some debugging steps I have taken so they can serve as a guide on how to narrow stuff like this down.

  • I took your file as is and did "npm install". That resulted in no bindings file being built. (remove node_modules)
  • Removed all the devDeps and did "npm install" bindings file was built, so must be in devDeps (remove node_modules)
  • Remove all regular deps except bcrypt
  • Removed top half of devDeps and did "npm install" and bindings file was built, so maybe problem is there (remove node_modules)
  • Did this again until I was left with only the grunt-bk-filerev was left and the problem with not building the binding file persisted
  • So, conclusion, the issue is between some weird interaction of that module being depended on (which also installs grunt) and the bcrypt module (other binary modules seemed to build so I dunno).

    I don't use grunt so at this point my interest has stopped since our module is fine without grunt :) But I do suggest you investigate this further now that you know better how to reproduce the error:

    "name": "xxx", "version": "0.0.15", "dependencies": { "bcrypt": "0.7.7" "devDependencies": { "grunt-bk-filerev": "0.1.3"

    I will see if others can reproduce the failure given this package.json as it may be a bug with npm (sounds to me like it is). Until then hopefully you can find a workaround by using less grunt ;p

    Oh man, that module grunt-bk-filerev sucked. I replaced it with the original one and now it worked.

    No idea why but not I can install bcrypt properly. Indeed, this is weird. A bad module should not interfere with another module. Something smells but cannot say what.

    Anyway, all good now. Many thanks @defunctzombie, I owe you one beer ;)

    @defunctzombie Grrrr, the problem is back :(

    bcrypt was not installed on my mac machine. Interesting. It does not happen on my other Linux machine.

    Running "mochaTest:server" (mochaTest) task
    >> Mocha exploded!
    >> Error: Could not load the bindings file. Tried:
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/build/bcrypt_lib.node
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/build/Debug/bcrypt_lib.node
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/build/Release/bcrypt_lib.node
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/out/Debug/bcrypt_lib.node
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/Debug/bcrypt_lib.node
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/out/Release/bcrypt_lib.node
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/Release/bcrypt_lib.node
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/build/default/bcrypt_lib.node
    >>   /Users/mick/projects/signdna/node_modules/bcrypt/compiled/0.10.24/darwin/x64/bcrypt_lib.node
    >>     at bindings (/Users/mick/projects/signdna/node_modules/bcrypt/node_modules/bindings/bindings.js:84:13)
    >>     at Object.<anonymous> (/Users/mick/projects/signdna/node_modules/bcrypt/bcrypt.js:1:97)
    >>     at Module._compile (module.js:456:26)
    >>     at Object.Module._extensions..js (module.js:474:10)
    >>     at Module.load (module.js:356:32)
    >>     at Function.Module._load (module.js:312:12)
    >>     at Module.require (module.js:364:17)
    >>     at require (module.js:380:17)
    >>     at Object.<anonymous> (/Users/mick/projects/signdna/server/lib/models/user.js:4:14)
    >>     at Module._compile (module.js:456:26)

    It is weird, bcrypt is in my package.json:

    "name": "xxx", "scripts": { "start": "node ./server/server.js", "preinstall": "sudo npm install -g supervisor grunt grunt-cli bower", "postinstall": "npm prune && bower prune && bower install", "preupdate": "sudo npm update -g supervisor grunt grunt-cli bower", "postupdate": "npm prune && bower prune && bower update", "test": "grunt test" "engines": { "node": "~0.10.24", "npm": "~1.3.21" "dependencies": { "express": "3.4.7", "bunyan": "0.22.1", "settings": "0.1.1", "merge-recursive": "0.0.3", "jade": "1.0.2", "gaze": "0.4.3", "nodemailer": "0.6.0", "errormailer": "0.2.1", "slug": "0.4.0", "require-directory": "1.2.0", "avconv": "0.2.6-2", "node-uuid": "1.4.1", "level-sublevel": "5.2.0", "level": "0.18.0", "level-exists": "0.0.3", "fs.extra": "1.2.1", "once": "1.3.0", "connect-stream": "1.1.2", "passport": "0.1.18", "async": "0.2.9", "bcrypt": "0.7.7", "longjohn": "0.2.2", "passport-facebook": "1.0.2", "passport-google": "0.3.0", "formidable": "1.0.14", "juice": "0.4.0", "create-error": "0.3.1", "monotonic-timestamp": "0.0.8" "devDependencies": { "grunt-contrib-clean": "0.5.0", "grunt-contrib-less": "0.8.3", "grunt-contrib-watch": "0.5.3", "grunt-filerev-assets": "0.3.0", "grunt-bg-shell": "2.3.1", "grunt-bunyan": "0.4.3", "grunt-contrib-requirejs": "0.4.1", "grunt-mocha-test": "0.8.1", "grunt-env": "0.4.1", "matchdep": "0.3.0", "chai": "1.8.1", "grunt-contrib-copy": "0.5.0", "grunt-contrib-imagemin": "0.4.0", "time-grunt": "0.2.7", "grunt-css-url-rewrite": "0.3.2", "grunt-browser-sync": "0.4.6", "levelweb": "0.4.1-1", "mocha": "1.16.2", "phantomjs": "1.9.2-6", "grunt-mocha-webdriver": "0.9.15", "grunt-contrib-jshint": "0.8.0", "grunt-jsbeautifier": "0.2.6", "grunt-retire": "0.1.21", "grunt-filerev": "0.2.0", "rjs-build-analysis": "0.0.3"

    Can anybody of you copy this package.json and test it by running npm install on your mac machine?

    I am able to start the server when I install bcrypt manually with npm install bcrypt but not with npm install ... weird!

    why do you ask me when this is a npm thing? if package.json fails to declare all the dependencies such as the correct python version, then address this to the makers of npm.

    furthermore - if you don't mind me being straightforward - i think python has no major place in the javascript universe. i totally understand that node-gyp is required because of all those different platforms. sounds like blaming the user whereas the user-land configures the installation process. in other words, blame eve for eating the apple whereas the apple was laid out by a higher power (just a 'bad' example, i am not that religious ;)

    At the moment, if you want the module to work you'll have to setup some of
    the dependencies yourself. We depend on other modules to handle platform
    and OS comparability. These dependencies have other dependencies. We make
    note of these in the readme. For instance if you want to use the module you
    currently have to compile it which means you'll need a compiler, we're not
    going to include one here...

    This isn't about blaming the user, just notes the current state of cross
    platform node addons. This may change at some point but that'll definitely
    be down the road.

    On 8:46AM, Sat, Jan 10, 2015 Michael Heuberger notifications@github.com
    wrote:

    why do you ask me when this is a npm thing? if package.json fails to
    declare all the dependencies such as the correct python version, then
    address this to the makers of npm.

    furthermore - if you don't mind me being straightforward - i think python
    has no major place in the javascript universe. i totally understand that
    node-gyp is required because of all those different platforms. sounds like
    blaming the user whereas the user-land configures the installation process.
    in other words, blame eve for eating the apple whereas the apple was laid
    out by a higher power (just a 'bad' example, i am not that religious ;)

    Reply to this email directly or view it on GitHub
    #193 (comment)