Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/published-install-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ jobs:
echo "packed $tgz"

# a global install, into its own prefix so it needs no sudo: the same layout as
# /usr/lib/node_modules/fhirsmith. The dependencies come from the registry, as for npm install -g fhirsmith
# /usr/lib/node_modules/fhirsmith. The dependencies come from the registry, as for npm install -g fhirsmith.
# --allow-scripts is the install command in the README: npm 12 doesn't run the install scripts of
# dependencies unless they are allowed, and for a global install only the command line or the user's
# npm config can allow them (the allowScripts in our package.json isn't read). Without it sqlite3,
# better-sqlite3 and roaring are left without their binary. Keep the list the same as in the README
- name: Install the package globally
run: |
prefix="$RUNNER_TEMP/global"
npm install -g --prefix "$prefix" "$TGZ"
npm install -g --prefix "$prefix" --allow-scripts=bcrypt,better-sqlite3,koffi,roaring,sqlite3 "$TGZ"
echo "PKG_DIR=$(npm root -g --prefix "$prefix")/fhirsmith" >> "$GITHUB_ENV"

- name: Check the installed package
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

-
- The 1.1.0 npm package didn't include `ips/vendor/` (the IPS export libraries the server loads at startup): `.npmignore` had an unanchored `vendor/`
- `npm install -g fhirsmith` with npm 12 leaves sqlite3, better-sqlite3 and roaring without their native binary (any FHIRsmith version; roaring is a dependency since 1.1.0): npm 12 doesn't run the install scripts of dependencies unless they are allowed, and for a global install it doesn't read the `allowScripts` in our package.json. The install command in the README is now `npm install -g --allow-scripts=bcrypt,better-sqlite3,koffi,roaring,sqlite3 fhirsmith`, and the published install check installs that way

### Removed

Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ use the `FHIRSMITH_DATA_DIR` environment variable to locate the data directory.
### npm Global Install

```bash
# Install globally
npm install -g fhirsmith
# Install globally, allowing the native modules' install scripts (see below)
npm install -g --allow-scripts=bcrypt,better-sqlite3,koffi,roaring,sqlite3 fhirsmith

# Create a data directory
mkdir -p /var/lib/fhirsmith
Expand All @@ -197,6 +197,23 @@ FHIRSMITH_DATA_DIR=/var/lib/fhirsmith fhirsmith
For cluster mode (a master and tx-workers - see [cluster.md](cluster.md)), run `fhirsmith-cluster`
instead of `fhirsmith`.

#### Why `--allow-scripts`

Three of FHIRsmith's dependencies (sqlite3, better-sqlite3 and roaring) get their native binary
from an install script. npm 12 doesn't run the install scripts of dependencies unless they are
allowed, and for a global install it only takes that from the command line or your npm config.
A plain `npm install -g fhirsmith` with npm 12 finishes without an error (npm lists the blocked
scripts in a warning), and the server then stops at startup with "Could not locate the bindings
file" or "Cannot find module './build/Release/roaring.node'". npm 11 runs the scripts either way.

Instead of the option, the scripts can be allowed once for all global installs by this user:

```bash
npm config set allow-scripts=bcrypt,better-sqlite3,koffi,roaring,sqlite3 --location=user
```

To repair an install made without it, install again with the option.

### Changing the Node.js version

Some of FHIRsmith's dependencies (the SQLite drivers) are native modules, built for the
Expand Down
Loading