njam / citygml-to-3dtiles

Convert from CityGML to Cesium 3D Tiles.
Apache License 2.0
160 stars 41 forks source link

How to run it on Windows? #4

Closed DS-nick closed 4 years ago

DS-nick commented 5 years ago

I work with Nodejs 10.9, when I run the script Install the conversion script npm install citygml-to-3dtiles

Run the conversion: node --experimental-modules --max-old-space-size=10000 node_modules/.bin/citygml-to-3dtiles \ Delft_3dfier.gml 3dtiles/

In the end I get erros in the console (node:7124) ExperimentalWarning: The ESM module loader is experimental. Z:\Work\temp\node_modules.bin\citygml-to-3dtiles:2 basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^

SyntaxError: missing ) after argument list at new Script (vm.js:73:7) at createScript (vm.js:245:10) at Proxy.runInThisContext (vm.js:297:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at createDynamicModule (internal/modules/esm/translators.js:56:15) at setExecutor (internal/modules/esm/create_dynamic_module.js:50:23)

njam commented 5 years ago

The warning is expected, and you can safely ignore it (ExperimentalWarning: The ESM module loader is experimental.).

The error you see (SyntaxError: missing ) after argument list) seems to happen because NPM on Windows wraps binaries in a shell script (see npm/cmd-shim). This wrapper script is not meant to be executed by node, but rather by sh. The reason I suggest executing the script with node is for being able to pass the parameters --experimental-modules and --max-old-space-size.

I don't use Windows so I can't investigate this properly. But here's an idea: could you try using the NPM binary executor script npx?

Install:

npm install -g citygml-to-3dtiles npx

The run the script with npx:

npx -n '--experimental-modules' -n '--max-old-space-size=10000' citygml-to-3dtiles Delft_3dfier.gml 3dtiles/