Stream: shorthand
Topic: Running Sushi from command line
Grahame Grieve (Dec 01 2021 at 22:55):
I have an npm question - a deep techie question. I'm running on windows, and I can run sushi from the Java IG Publisher using cmd /c sushi . -o.
. But I can't run it from the command line - I get
'sushi' is not recognized as an internal or external command,
operable program or batch file.
So that's weird. I can run it as npx fsh-sushi . -o .:
npx: installed 901 in 14.016s
info Running SUSHI v2.2.1 (implements FHIR Shorthand specification v1.2.0)
info Arguments:
info --out C:\Users\graha
info C:\Users\graha
error
This ends with the rather surprising error:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SUSHI has adopted a new folder structure for FSH tanks (a.k.a. SUSHI projects).
Support for other folder structures is NO LONGER SUPPORTED.
To migrate to the new folder structure, make the following changes:
- rename .\config.yaml to .\sushi-config.yaml
- move .\*.fsh files to .\input\fsh\*.fsh
- if you used the "template" property in your config, remove it and manage .\ig.ini directly
- if you used the "history" property in your config, remove it and manage .\package-list.json directly
- ensure your .gitignore file is not configured to ignore the sources in their new locations
- add /fsh-generated to your .gitignore file to prevent SUSHI output from being checked into source control
NOTE: After you make these changes, the default output folder for SUSHI will change to .\fsh-generated.
For detailed migration instructions, see: https://fshschool.org/docs/sushi/migration/
error Migration to current SUSHI project structure is required. See above error message for details. Exiting.
That's surprising because there's no sushi config at all in that directory I ran it in (but it's a side point compared to my actual question which is around getting sushi to run at all).
So that's when I run the java code from the command line, or from eclipse. But I also run it some a windows GUI app. When I do that - run the java code, that is - then neither sushi
no npx fsh-sushi works.
it's not really surprising that the first fails, since i can't run sushi from the command line - but why not? is there anything npm users know about how I can fix that?
And when I run npx fhs-sushi from my GUI app, then I get
Run Sushi on C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master (00:00.0019)
Sushi: 'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command, (00:00.0065)
Sushi: operable program or batch file. (00:00.0066)
Sushi: spawn C:\Windows\system32\cmd.exe= ENOENT (00:00.0202)
Sushi couldn't be run. Complete output from running Sushi : (00:00.0211)
Note: Check that Sushi is installed correctly ("npm install -g fsh-sushi". On windows, get npm from https://www.npmjs.com/get-npm) (00:00.0211)
Exception: Process exited with an error: 1 (Exit value: 1) (00:00.0212)
Publishing Content Failed: Process exited with an error: 1 (Exit value: 1) (00:00.0213)
That's a pretty weird error inside the npm sub-system right? As far as running the java code... I'm reproducing all the environment variables, and passing them to the java process, but I'm not running cmd (I don't think I need that?). So I'm at sea here - do the npm users here have any insight?
Chris Moesel (Dec 01 2021 at 23:06):
Do you know if you have sushi installed as a global module on your system? To check this, run npm list -g --depth 0
. If you see fsh-sushi
listed, then you have it installed globally. If you do not see it listed, then run npm install -g fsh-sushi
to install it. After that, you should be able to run sushi
from the command line.
If you do have sushi installed globally but it's still not working from the command line, then the global npm modules are probably not in your path. Maybe try out the solutions from this SO to see if they work? https://stackoverflow.com/questions/23860262/npm-global-install-does-not-add-packages-to-path-on-windows-8-1
As for the issue from the GUI -- I'm not really sure about that one...
Grahame Grieve (Dec 01 2021 at 23:07):
C:\Users\graha>npm list -g --depth 0
C:\Users\graha\AppData\Roaming\npm
`-- fsh-sushi@2.2.0
Grahame Grieve (Dec 01 2021 at 23:12):
but the stack overflow link sorted out the command line issue. I'll try the other again
Grahame Grieve (Dec 01 2021 at 23:39):
and I get further from my GUI app too. But... there's a weird thing happening. Running from Eclipse directly:
Run Sushi on C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master (00:00.0018)
Sushi: info Running SUSHI v2.2.1 (implements FHIR Shorthand specification v1.2.0) (00:00.0581)
Sushi: info Arguments: (00:00.0582)
Sushi: info --out C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master (00:00.0582)
Sushi: info C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master (00:00.0583)
Sushi: info Using configuration file: C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master\sushi-config.yaml (00:00.0590)
Sushi: info Importing FSH text... (00:00.0600)
Sushi: info Preprocessed 32 documents with 48 aliases. (00:00.0883)
Sushi: info Imported 140 definitions and 108 instances. (00:01.0033)
Sushi: info Checking local cache for hl7.fhir.us.core#4.0.0... (00:01.0034)
Sushi: info Found hl7.fhir.us.core#4.0.0 in local cache. (00:01.0081)
Sushi: info Loaded package hl7.fhir.us.core#4.0.0 (00:01.0081)
Sushi: info Checking local cache for hl7.fhir.r4.core#4.0.1... (00:01.0081)
Sushi: info Found hl7.fhir.r4.core#4.0.1 in local cache. (00:01.0606)
Sushi: info Loaded package hl7.fhir.r4.core#4.0.1 (00:01.0606)
Sushi: (node:19764) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency (00:01.0607)
Sushi: (Use `node --trace-warnings ...` to show where the warning was created) (00:01.0607)
Sushi: (node:19764) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency (00:01.0607)
Sushi: info Converting FSH to FHIR resources... (00:01.0652)
Sushi: info Converted 42 FHIR StructureDefinitions. (00:18.0815)
Sushi: info Converted 2 FHIR CodeSystems. (00:18.0821)
Sushi: info Converted 96 FHIR ValueSets. (00:19.0150)
Sushi: info Converted 108 FHIR instances. (00:24.0349)
Sushi: info Exporting FHIR resources as JSON... (00:24.0349)
Sushi: info Exported 248 FHIR resources as JSON. (00:25.0319)
Sushi: info Assembling Implementation Guide sources... (00:25.0319)
Sushi: info Generated ImplementationGuide-hl7.fhir.us.mcode.json (00:25.0329)
Sushi: info Assembled Implementation Guide sources; ready for IG Publisher. (00:25.0329)
Sushi: (00:25.0330)
Sushi: ========================= SUSHI RESULTS =========================== (00:25.0330)
Sushi: | ------------------------------------------------------------- | (00:25.0330)
Sushi: | | Profiles | Extensions | Logicals | Resources | | (00:25.0330)
Sushi: | |-------------------------------------------------------------| | (00:25.0331)
Sushi: | | 28 | 14 | 0 | 0 | | (00:25.0331)
Sushi: | ------------------------------------------------------------- | (00:25.0331)
Sushi: | ------------------------------------------------------------- | (00:25.0331)
Sushi: | | ValueSets | CodeSystems | Instances | | (00:25.0332)
Sushi: | |-------------------------------------------------------------| | (00:25.0332)
Sushi: | | 96 | 2 | 108 | | (00:25.0332)
Sushi: | ------------------------------------------------------------- | (00:25.0333)
Sushi: | | (00:25.0333)
Sushi: =================================================================== (00:25.0333)
Sushi: | Ex-clam-ation point! 0 Errors 0 Warnings | (00:25.0333)
Sushi: =================================================================== (00:25.0334)
Grahame Grieve (Dec 01 2021 at 23:39):
running from my gui:
Grahame Grieve (Dec 01 2021 at 23:40):
Run Sushi on C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master (00:00.0018)
Sushi: info Running SUSHI v2.2.1 (implements FHIR Shorthand specification v1.2.0) (00:00.0573)
Sushi: info Arguments: (00:00.0574)
Sushi: info --out C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master (00:00.0574)
Sushi: info C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master (00:00.0575)
Sushi: info Using configuration file: C:\work\org.hl7.fhir.igs\HL7-fhir-mCODE-ig#master\sushi-config.yaml (00:00.0619)
Sushi: info Importing FSH text... (00:00.0629)
Sushi: info Preprocessed 32 documents with 48 aliases. (00:00.0913)
Sushi: info Imported 140 definitions and 108 instances. (00:01.0068)
Sushi: info Checking local cache for hl7.fhir.us.core#4.0.0... (00:01.0069)
Sushi: info Did not find hl7.fhir.us.core#4.0.0 in local cache. (00:01.0069)
Sushi: info Checking local cache for hl7.fhir.r4.core#4.0.1... (00:01.0070)
Sushi: info Did not find hl7.fhir.r4.core#4.0.1 in local cache. (00:01.0070)
Sushi: (node:36160) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency (00:01.0071)
Sushi: (Use `node --trace-warnings ...` to show where the warning was created) (00:01.0072)
Sushi: (node:36160) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency (00:01.0072)
Sushi: info Downloading hl7.fhir.us.core#4.0.0... (00:01.0095)
Sushi: info Downloading hl7.fhir.r4.core#4.0.1... (00:01.0096)
Sushi: error Failed to load hl7.fhir.us.core#4.0.0: getaddrinfo EAI_FAIL packages2.fhir.org (00:01.0097)
Sushi: error Failed to load hl7.fhir.r4.core#4.0.1: getaddrinfo EAI_FAIL packages2.fhir.org (00:01.0097)
Sushi: error Valid StructureDefinition resource not found. The FHIR package in your local cache may be corrupt. Local FHIR cache can be found at <home-directory>/.fhir/packages. For more information, see https://wiki.hl7.org/FHIR_Package_Cache#Location. (00:01.0135)
Grahame Grieve (Dec 01 2021 at 23:41):
any ideas what's going on here?
Elliot Silver (Dec 02 2021 at 00:03):
I'm just taking a WAG, but I wonder if your current working directory and environment variables, particularly PATH, differ when launched from the command line vs. the GUI. Also, whether the launched process inherits those, or go back to some defaults.
Grahame Grieve (Dec 02 2021 at 18:17):
I clone all the environment variables. But yes, they are from the launching process, though it doesn't do anything different
Chris Moesel (Dec 02 2021 at 20:25):
That's definitely odd... When SUSHI tries to load packages, it tries first from packages.fhir.org
. If that produces an error, it swallows it and tries packages2.fhir.org
. If that produces an error, it runs it up the stack. That's why you see the error for packages2.fhir.org
even though I'd guess it's actually happening on packages.fhir.org
first. Are the network parameters any different when running in the GUI? Might it be using a different set of certificates? Or different DNS? Or anything like that? Does Java GUI have more restrictive security that might be aborting networking attempts from a forked process (which is I think how IGP runs SUSHI)?
Last updated: Apr 12 2022 at 19:14 UTC