Skip to content

Bluebird fails to load in a nwjs (nodewebkit) app #525

Closed

Description

@NervosaX

It gives me the error:

[23637:0312/105955:INFO:CONSOLE(81)] "Uncaught TypeError: Cannot read property 'isStatic' of undefined", source: file://.../dist/jspm_packages/npm/bluebird@2.9.10/js/browser/bluebird.js (81)
[23637:0312/105955:ERROR:nw_shell.cc(335)] Error evaluating file://.../dist/jspm_packages/npm/bluebird@2.9.10/js/browser/bluebird.js
Uncaught TypeError: Cannot read property 'isStatic' of undefined
[23637:0312/105955:INFO:CONSOLE(2237)] "Uncaught Error evaluating file://.../dist/jspm_packages/npm/bluebird@2.9.10/js/browser/bluebird.js
Uncaught TypeError: Cannot read property 'isStatic' of undefined", source: file://.../dist/jspm_packages/system.src.js (2237)

I've shortened the filenames for readability.

I can confirm that it worked fine in bluebird version 2.9.3, but I'd say that after commit 98b0252 the issue occurred.

Reading over the code in that commit, it seems to be because
typeof window === "undefined"
isn't part of the isNode check. If I add this line manually then my application runs.

Activity

  1. petkaantonov commented on Mar 12, 2015

    @petkaantonov
    Owner

    Try with at least 2.9.6+

  2. NervosaX commented on Mar 12, 2015

    @NervosaX
    Author

    2.9.6 works. 2.9.13 fails.
    I tried every version between 2.9.7 and 2.9.13 and each failed.

  3. petkaantonov commented on Mar 12, 2015

    @petkaantonov
    Owner

    Does node webkit delete the global setImmediate function or something? That's what's being undefined ... that or process nextTick?

    What does process.versions.node say in nw?

  4. NervosaX commented on Mar 12, 2015

    @NervosaX
    Author

    It gives me: "1.2.0"

  5. petkaantonov commented on Mar 12, 2015

    @petkaantonov
    Owner

    That means global.setImmediate is undefined, why does nw delete it?

  6. NervosaX commented on Mar 12, 2015

    @NervosaX
    Author

    I found this old commit for nw.js nwjs/nw.js#897

    Sure enough if I add this line, bluebird will work.

    if (typeof global !== "undefined") {
        window.setImmediate = global.setImmediate;
    }
    

    That's pretty unfortunate, as I'm not sure if it should be bluebird's problem to deal with that sort of issue.

  7. petkaantonov commented on Mar 12, 2015

    @petkaantonov
    Owner

    Well promises should always use nextTick anyway, I am not sure what the reason for the check even was originally. setImmediate is macro task.

  8. added 2 commits that reference this issue on Mar 26, 2015
    9b6d04a
    4201092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions