Comments (9)
The TypeError is most likely due to Proxy.create
being undefined
on iojs. After a quick look at the latest v8/iojs settings, it seems you must pass the --harmony_proxies
flag at startup to enable the Proxy
object, which this library tries to patch.
I'll try to make the code more robust so that it doesn't fail in this way when Proxy
is not available.
from harmony-reflect.
Try upgrading to v1.3.1. I just released a minor patch that tightens the check for Proxy
, which I suspect should make this problem go away.
from harmony-reflect.
Closing this issue. Please reopen or comment if my earlier suggestions didn't fix the issue.
from harmony-reflect.
Sorry it took so long to get back to you. This update does not solve the issue. When harmony-reflect is depended on by multiple packages I get the problem. After harmony-reflect gets loaded the first time, Proxy
is still defined, but Proxy.create
is not, so the shim doesn't work.
So now I'm just getting your new error, Error: proxies not supported on this platform. On v8/node/iojs, make sure to pass the --harmony_proxies flag
.
Let me know if there is anything else you need to know. Thanks!
from harmony-reflect.
I'll investigate further. Are the multiple packages that depend on harmony-reflect public npm packages? If so, that could be useful info to debug the issue.
And just to be sure: you did start iojs
using iojs --harmony_proxies
, right?
from harmony-reflect.
Yep, I'm running iojs with --harmony_proxies
.
I've been using harmony reflect with my camo project. The latest version v0.5.0 uses a forked version of harmony-reflect that checks a global variable to determine if harmony-reflect has already been loaded. If it has already been loaded, then it just returns. This has fixed the issue for me.
v0.3.1 depends on harmony-reflect from npm in case you want to check it out.
I know node.js is supposed to cache a module once it is loaded (so the code is only ran once), but is this also true for a module that is depended on by multiple separate packages? I'm wondering if part of the problem could be that I'm using npm link
to depend on some private local packages, so maybe the caching doesn't work the same way in this case, and harmony-reflect is loaded multiple times.
This is how the dependencies are set up:
Camo: Depends on harmony-reflect
A: Depends on Camo
B: Depends on A (via npm link
) and Camo
So harmony-reflect shows up twice in the dependency tree.
Camo is on npm, but A and B are private. B is the top-level project.
Hope this helps some. Let me know if you need any more info. Unless others are having the same issue, I wouldn't worry about it too much since I have a work-around.
from harmony-reflect.
Thanks for the additional info. node indeed caches modules, but as every npm module can specify its own requirements in its package.json, I wouldn't be surprised if node would load multiple versions of the same module. In fact, that may be what's going on here, if A, B and Camo specify different versions of harmony-reflect.
from harmony-reflect.
Ok, I can replicate your observed behavior by requiring first the published npm module and then my local developer copy of harmony-reflect, so it's definitely the case that the library in its current form is not robust against two versions of itself being loaded.
steps to replicate (in a directory containing a local copy of this repo):
var assert = require('assert');
require('harmony-reflect')
assert(new Proxy({}, {}).toString() === '[object Object]');
require('./reflect')
assert(new Proxy({}, {}).toString() === '[object Object]'); // fails
from harmony-reflect.
I released version 1.4.0 which, when loaded twice according to the script outlined above, loads correctly.
Note that loading v1.3.1 of this library followed by v1.4.0 will still fail (the other way around works fine). So it's important that your dependencies upgrade to the latest version.
from harmony-reflect.
Related Issues (20)
- get handler with Symbol HOT 6
- Reflect.Loader HOT 2
- Incompatible with Edge browser HOT 4
- Extending proxy classes HOT 3
- Cannot properly Proxy 'os' methods HOT 2
- Possible incompatibility gulp/jscs HOT 1
- Provide option to turn off warning "getOwnPropertyNames trap is deprecated. Use ownKeys instead" HOT 6
- harmony-reflect borks node repl
- Error when using Reflect.construct on ES2015 classes
- Calling Object.getOwnPropertySymbols() on a Proxy throws an error HOT 2
- 'Illegal access' error when using Object.assign() HOT 1
- Is there a way to conditionally load harmony-reflect HOT 2
- Question: Does this work with IE11? HOT 2
- Conflict with `reflect-metadata` HOT 6
- What is the actual license of this package? HOT 2
- Reflect.construct incorrectly calls newTarget, causing infinite loops HOT 1
- Is Reflect.set working as intended?
- Index not found HOT 8
- Does this polyfill works for chrome version 38 ? HOT 3
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 harmony-reflect.