Giter Club home page Giter Club logo

Comments (9)

tvcutsem avatar tvcutsem commented on May 8, 2024

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.

tvcutsem avatar tvcutsem commented on May 8, 2024

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.

tvcutsem avatar tvcutsem commented on May 8, 2024

Closing this issue. Please reopen or comment if my earlier suggestions didn't fix the issue.

from harmony-reflect.

scottwrobinson avatar scottwrobinson commented on May 8, 2024

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.

tvcutsem avatar tvcutsem commented on May 8, 2024

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.

scottwrobinson avatar scottwrobinson commented on May 8, 2024

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.

tvcutsem avatar tvcutsem commented on May 8, 2024

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.

tvcutsem avatar tvcutsem commented on May 8, 2024

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.

tvcutsem avatar tvcutsem commented on May 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.