Search code examples
ice

Cannot read property 'Promise' of undefined in ice demo


https://doc.zeroc.com/display/Ice36/Writing+an+Ice+Application+with+JavaScript

Just the official website example,when I run node Client.js,

Ice.Promise.try(
   ^

TypeError: Cannot read property 'Promise' of undefined
    at Object.<anonymous> (/home/lanceloft/learn/ice/Client.js:6:4)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:504:3

system: ubuntu16.04


Solution

  • Looks like a bug in the documentation, require("icejs") should be replaced with require("ice"). Can you try to see if that fixes your problem?

    We'll fix the documentation! Otherwise, you can take a look at the JavaScript demos here for some starting points> https://github.com/zeroc-ice/ice-demos/tree/3.6/js

    Benoit.