repeat
repeat

Reputation: 18726

Using Tau-Prolog with Node.js

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.

Upvotes: 1

Views: 507

Answers (1)

Austin Hill
Austin Hill

Reputation: 119

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.

Upvotes: 2

Related Questions