lforms-fhir-app
lforms-fhir-app copied to clipboard
App not building/starting under Windows
Out of the box the app simply does not build under Windows 11.
I encountered the following problems:
-
node -e '(new (require(\"ssi\"))(\"source/html-ssi\", \".tmp\", \"/*.html\", true)).compile()'
does not work under windows, the quotes have to be switched (thank you @plynchnlm for the help) -
$npm_package_version
and similar variable names did not work, I needed to use%npm_package_version%
(in the end I hard coded it while trying to fix anpther bug. -
PARCEL_WORKER_BACKEND=process
did not work for me, I needed to useset PARCEL_WORKER_BACKEND=\"process\"
(not sure if the double quotes are mandatory or not) - The
sed
command was not recogniced by PowerShell or cmd, I ended up using git bash as a work around.
I managed to adapt my package.json to the point where the app builds, starts and runs properly from git bash (Git for Windows v2.27.0).
I didn't get the app to build properly from PowerShell oder cmd, as I didn't find a good replacement for the sed
command in the time I had.
I only used npm run build
und npm run start
commands and did not test the other commands.
My solution is probably not optimal and I didn't test whether or not it still works under Linux.
That is the script part of my package.json.
"scripts": {
"build:clean": "rimraf dist .tmp",
"build:pages": "node -e \"(new (require('ssi'))('source/html-ssi', '.tmp', '/*.html', true)).compile()\"",
"build:preparcel": "npm run build:clean && npm run build:pages",
"build-dev": "npm run build:preparcel && PARCEL_WORKER_BACKEND=process parcel build --dist-dir dist/lforms-fhir-app --public-url . --no-optimize",
"build:parcel": "npm run build:parcelEnv && npm run build:parcelBuild",
"build:parcelEnv": " set PARCEL_WORKER_BACKEND=\"process\"",
"build:parcelBuild": "parcel build --dist-dir dist/lforms-fhir-app --public-url .",
"build:version": "sed -i s/VERSION_PLACEHOLDER/3.1.0/ dist/lforms-fhir-app/index.html",
"build": "npm run build:preparcel && npm run build:parcel && npm run build:version",
"prestart": "echo \"Website starting at http://localhost:8000/lforms-fhir-app\"",
"start": "http-server -s -o lforms-fhir-app -a localhost -p 8000 -c-1 dist",
"start-no-open": "http-server -s -a localhost -p 8000 -c-1 dist",
"start-public": "http-server -s -o lforms-fhir-app -p 8000 -c-1 dist",
"prestart-public": "npm run prestart",
"test": "npm run start-no-open & sleep 5; npm run cy:run; s=$?; kill %1; exit $s",
"cy:open": "cypress open",
"cy:run": "cypress run"
},