Comments (9)
This was also found (and solved) in Issue 305 of stefanpenner's es6-promise package (patched in this commit).
tl;dr he edited when/lib/env.js
:
} else if (!capturedSetTimeout) { // vert.x
- var vertxRequire = require;
- var vertx = vertxRequire('vertx');
+ var vertx = Function('return this')().require('vertx');
setTimer = function (f, ms) { return vertx.setTimer(ms, f); };
clearTimer = vertx.cancelTimer;
asap = vertx.runOnLoop || vertx.runOnContext;
}
Understandably not the cleanest patch but it did the job.
from when.
I'm seeing this error during build time with node 4.2.2
and npm 3.8.1
. I've gotten around this error by adding { vertx = 'commonjs vertx' }
to my webpack config file under externals
.
from when.
@theMK2k I hardly expect that when
would release a new version and make it works with webpack
:
webpack.config = {
resolve: {
alias: {
vertx: 'path/to/stub-vertx',
}
}
};
// stub-vertx.js
module.exports = this;
from when.
@lookapanda That's a very odd error. I'm not able to reproduce it (and surely we would have heard about it before since it appears to make when completely unusable!). Could you provide a bit more info:
- What version of node are you using?
- What does this report:
$ node
> Object.prototype.toString.call(process)
Thanks!
from when.
I get the same error and my system is debian sid.
$ node
> Object.prototype.toString.call(process)
'[object process]'
The node version in my case is 5.7.1
from when.
Hmmm, is that error happening during application runtime? Or is it happening at build time when using some sort of build tool, like webpack, browserify, rollup, etc?
If that error is being reported at runtime (as opposed to build time, e.g. browserify, webpack, etc.), the only way control could ever reach this line is if all three of these things are true:
- The environment isn't recognized as Node, and
- the environment doesn't have MutationObserver (obviously this is browser only), and
- the environment doesn't have
setTimeout
The only way to detect if code is running in vertx is to rule out other environments (using the tests above), and then assume vertx and just try to require() it. However, build tools scan source code and ASTs looking for require statements in order to create bundles.
So, if that error is happening at build time, then I think the right thing to do is to configure your build tool to ignore vertex
.
from when.
I don't remember but i think that was a problem during the build time but I had an old version of npm and after the update the problem disappear.
from when.
I had the same issue and the fix proposed by @belenbarbed works. My setup is an electron application.
Any chance that this fix gets an implementation in the official when
release?
from when.
I've also solved this issue on my end by changing ./lib/env.js line 32:
from - var vertx = vertxRequire('vertx');
to - var vertx =vertxRequire('@vertx/core');
and also installing @vertx/core
with npm
Hopefully some patch will fix this at some point (however unlikely since this is nearly 5yrs old)
from when.
Related Issues (20)
- JSPM build (SystemJS builder) failing on [email protected] HOT 3
- Does not work in NodeJS (ReactJS Native) HOT 12
- Visual Studio debugger breakes from adding When to WebPack bundle. HOT 13
- 3.7.7 breakes the build on Windows HOT 2
- no such file or directory .... es6-shim/makePromise HOT 2
- Global rejection events completely broken in a bundled environment (eg. Webpack)
- When not working in Jasmine tests
- when.reduce UnhandledPromiseRejectionWarning HOT 4
- Misleading unhandled rejection warning when using when.settle HOT 10
- npm install ! has errors HOT 1
- Usage hello world example fails with TypeError HOT 3
- Binding context to promise chain HOT 2
- Add react-native support HOT 2
- File 404 when try to use in browser environment
- Promise.js first function never runs HOT 2
- RTE TypeError after production build HOT 4
- Does function call also accept promises? HOT 4
- Current project status HOT 1
- npm install failing with 404 error code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from when.