fnogatz / xsd2json

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

"Please run npm first" as CLI output #110

Open pierreprime opened 4 years ago

pierreprime commented 4 years ago

Hi there, and thanks for xsd2json's dev. I'm having a problem using this tool that I installed globally via npm, with straight-forward method or by cloning this repo.

When running : xsd2json output/xsd/no_options_spec.xsd > output/json-sc/no_options_exp.json I'm having the following output in resulting json file :

Please run
 npm install
first

I don't understand why I'd have to run npm install again. I have swipl v.7.6.4 on my system, and checked that its functionalities were reachable typing what you specified here : https://github.com/fnogatz/xsd2json/issues/53

I had to use sudo to get xsd2json installed globally, if ever this is important. I don't know if it's a good practice when using npm, I'm more of a PHP dev and with composer it is not. Searching the error message in the repo, I found it in cli.exe. But since I'm on linux I thought .exe file were not supposed to run.

One more thing : xsd2json --debug-info gives the same error msg about npm install. Thanks for your help and have a good weekend :)

fnogatz commented 4 years ago

Hi, thank you for reporting this! In fact, the output is returned as it is the default contents of /lib-pl/cli.exe (as can be seen here). It gets replaced after pre-compilation of the Prolog files. This process is normally initiated as part of npm install xsd2json, as it is defined as a preinstall script for npm in the package.json file. You can manually start the pre-compilation by just calling npm run preinstall. I just updated xsd2json's README.md accordingly (commit cfe3813ca895d81ce0af62900f7f45edf9dbf07a).

tl;dr: Chances are that you can just call npm run preinstall in xsd2json's root directory and give it another try :)

pierreprime commented 4 years ago

Thanks a lot for your return. I'll give it a try tomorrow

fnogatz commented 4 years ago

Hi @pierreprime, did you have a chance to review your issue?