Home Help Center

TypeError: Cannot redefine property: DoneListHelper

sulliwanesulliwane Member MaxOrganization: persoProject: chat middleware
edited September 2016 in Help Center


Here is my node app:

app.js (require folder1/ice.js and folder2/ice.js)
    ice.js (require Common.js)
    ice.js (require Common.js)

Folder1 and Folder2 content is the same. When I start my node app.js requiring folder1/ice.js and folder2/ice.js, I have this error:

TypeError: Cannot redefine property: OrderListHelper
    at Function.defineProperty (native)
    at Object.Slice.defineSequence (/node_modules/ice/src/Ice/ArrayUtil.js:123:12)
    at Common.js:524:11

Here is part of my Common.ice:

struct Order
    string  ordertype;
sequence<Order>          OrderList;

and here is part of my Common.js:

Slice.defineSequence(CM, "OrderListHelper", "CM.Order", false);

If I comment out the Slice.defineSequence(CM, "OrderListHelper", "CM.Order", false); in one of the Common.js, then the error disappear.

Any idea on this one?

Many thanks for your help :)


  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff


    Why do you have two copies of the Common.ice file and end up including the two generated Common.js file? You should instead only have one Common.ice file and a Common.js file that you can include safely multiple times.


  • sulliwanesulliwane Member MaxOrganization: persoProject: chat middleware

    my JS app is connecting to different ICE server, each server using a different version of this Common.ice, so I generate different versions like:

    • Common.v1.js
    • Common.v2.js
    • Common.v3.js

    And import them in different modules of my Node app. But as they are all redefining the same thing, there is an error. The define operation is probably global...is that voluntary design?

    Many thanks!

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff


    That is a limitation of our module system, modules are only defined the first time they appear and then the same module object is then reused, so you end up trying to redefine a property of a module when you include the generated code several times.

Sign In or Register to comment.