fnogatz / xsd2json

Translate XML Schema into equivalent JSON Schema
MIT License
149 stars 28 forks source link

npm install fails on Ubuntu #53

Closed lmichel closed 7 years ago

lmichel commented 7 years ago

Hi

I do not manage to install xsd2json with . swipl has ben installed from sources and sems to to work. I got the following errors which are opaque to me. That look like a broken dependency. Have you an idea?

Laurent

michel@obs-he-lm:~/gitRepositories/xsd2json$ sudo npm install -g xsd2json
/usr/bin/xsd2json -> /usr/lib/node_modules/xsd2json/lib-pl/cli

> xsd2json@1.7.12 postinstall /usr/lib/node_modules/xsd2json
> npm run create-qlf

> xsd2json@1.7.12 create-qlf /usr/lib/node_modules/xsd2json
> swipl -O --goal=main -o lib-pl/cli -c lib-pl/cli.pl

ERROR: /usr/lib/node_modules/xsd2json/lib-pl/helpers.pl:8:
    source_sink `library(sgml_write)' does not exist
Warning: /usr/lib/node_modules/xsd2json/lib-pl/helpers.pl:8:
    Goal (directive) failed: helpers:use_module(library(sgml_write))
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:9:
    source_sink `library(chr)' does not exist
Warning: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:9:
    Goal (directive) failed: xsd2json:use_module(library(chr))
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:10:
    source_sink `library(http/http_open)' does not exist
Warning: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:10:
    Goal (directive) failed: xsd2json:use_module(library(http/http_open))
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:13:
    source_sink `library(sgml)' does not exist
Warning: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:13:
    Goal (directive) failed: xsd2json:use_module(library(sgml))
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:30:18: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:40:18: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:42:1: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:56:18: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:63:1: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:78:18: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:85:1: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:90:18: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:99:1: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:111:18: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:115:1: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:130:18: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:147:18: Syntax error: Operator expected
ERROR: /usr/lib/node_modules/xsd2json/lib-pl/xsd2json.pl:152:1: Syntax error: Operator expected
....
fnogatz commented 7 years ago

This is due to broken SWI-Prolog packages, not missing npm dependencies. Make sure to install SWI-Prolog in a way you can use the bundled libraries. For instance, the following should work from command line:

> swipl

?- use_module(library(sgml)).
true.
?- use_module(library(chr)).
true.

In most Linux distributions there are software packages for SWI-Prolog available; e.g. swi-prolog in Ubuntu. The SWI-Prolog website introduces the build process for various operating systems. For Linux-OS, I recommend using the SWI-Prolog Version Manager swivm, which handles the installation of the required Prolog modules.

fnogatz commented 7 years ago

Closed since this is because of a broken SWI-Prolog installation. Nevertheless feel free to comment if you need help with your Prolog installation :)

lmichel commented 7 years ago

I'm sorry to reopen the issue. I'm an absolute beginner with Prolog. I properly setup my swipl with Aptitude and swivm as suggested

michel@obs-he-lm:~$ swipl --version
SWI-Prolog version 7.2.3 for x86_64-linux
michel@obs-he-lm:~$ swipl
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.2.3)
Copyright (c) 1990-2015 ....
?- use_module(library(sgml)).
true.
?- use_module(library(chr)).
true.

When I try to process a schema, I get nothing on stdout; then I switch to the trace mode and I get the following truncated output.

michel@obs-he-lm:~$ xsd2json -t purchaseorder.xsd
CHR:   (0) Insert: node_attribute(/home/michel/purchaseorder.xsd,[0],xmlns:xsd,http://www.w3.org/2001/XMLSchema,source) # <0>
....
....
CHR:   (1) Redo: node_attribute(/home/michel/purchaseorder.xsd,[0],xmlns:xsd,http://www.w3.org/2001/XMLSchema,source) # <0>
CHR:   (0) Fail: node_attribute(/home/michel/purchaseorder.xsd,[0],xmlns:xsd,http://www.w3.org/2001/XMLSchema,source) # <0>
ERROR: Prolog initialisation failed:
ERROR: Domain error: `chr_port' expected, found `none'

I've no idea at all (and Google either) about that chr_port. I guess that others users can have to face the same problem, even if is not a real issue.

LM

fnogatz commented 7 years ago

No problem, you're welcome :) I will have a look at your posted problems in your recently opened issue #54.