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

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

Closed
NervosaX opened this Issue Mar 12, 2015 · 7 comments

Comments

Projects
None yet
2 participants
@NervosaX

NervosaX commented Mar 12, 2015

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.

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Mar 12, 2015

Owner

Try with at least 2.9.6+

Owner

petkaantonov commented Mar 12, 2015

Try with at least 2.9.6+

@NervosaX

This comment has been minimized.

Show comment
Hide comment
@NervosaX

NervosaX Mar 12, 2015

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

NervosaX commented Mar 12, 2015

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

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Mar 12, 2015

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?

Owner

petkaantonov commented Mar 12, 2015

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?

@NervosaX

This comment has been minimized.

Show comment
Hide comment
@NervosaX

NervosaX Mar 12, 2015

It gives me: "1.2.0"

NervosaX commented Mar 12, 2015

It gives me: "1.2.0"

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Mar 12, 2015

Owner

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

Owner

petkaantonov commented Mar 12, 2015

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

@NervosaX

This comment has been minimized.

Show comment
Hide comment
@NervosaX

NervosaX Mar 12, 2015

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.

NervosaX commented Mar 12, 2015

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.

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Mar 12, 2015

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.

Owner

petkaantonov commented Mar 12, 2015

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

petkaantonov added a commit that referenced this issue Mar 26, 2015

petkaantonov added a commit that referenced this issue Mar 26, 2015

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