1

After downloading Tau-Prolog, I tried to run this example, but I was abruptly stopped:

$ nodejs ./sample.js bread
/home/stefan/Desktop/tau-prolog/tau-prolog.js:6117
    pl.type.is_dom_object = function( obj ) {
       ^

TypeError: Cannot read property 'type' of undefined
    at /home/stefan/Desktop/tau-prolog/tau-prolog.js:6117:5
    at Object. (/home/stefan/Desktop/tau-prolog/tau-prolog.js:6382:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object. (/home/stefan/Desktop/tau-prolog/sample.js:2:10)

This is my current configuration:

$ pwd
/home/stefan/Desktop/tau-prolog

$ ls
core.js  js.js        lists.js   sample.js      tau-prolog.js
dom.js   license.txt  random.js  statistics.js

$ uname -a
Linux stefan-TravelMate-B117-M 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ nodejs --version
v8.10.0

How can I get rid of this problem?


Edit

Seems the problem disappeared with the latest version of the system.

false
  • 10,264
  • 13
  • 101
  • 209
repeat
  • 18,496
  • 4
  • 54
  • 166

1 Answers1

2

The example has a placeholder path for importing tau-prolog.js:

var pl = require( "./path/to/tau-prolog.js" );

You need to replace "./path/to/tau-prolog.js" with the actual path to tau-prolog.js, which, in your case, should just be "./tau-prolog.js" since the file is in the same directory as the sample you are trying to run.

Austin Hill
  • 119
  • 1
  • 7
  • I already did that. You can tell from the logs I provided. Anything else? Which version of nodejs are you using? – repeat Feb 27 '19 at 15:38
  • Ah I see. I downloaded tau-prolog.js from here: http://tau-prolog.org/tau-prolog.js It looks like line 6117 of the file I downloaded does not match the line 6117 that is throwing an error for you. I think I need more information about the files that you're using. – Austin Hill Feb 27 '19 at 18:02