Running the web-tester
web-tester is a self-contained static server that hosts a built MapCore tester application. It
is the quickest way to see the engine rendering in a browser without writing any code: the app is
served at / and the MapCore WebAssembly engine at /mapcore.
The engine arrives automatically as a dependency — a configuration-specific @mapcore/… package
(for example @mapcore/wasm-32) containing MapCore.js, MapCore.wasm and the symbology .zip
files.
Prerequisites
- Node.js LTS (npm ships with it).
- Access to the MapCore npm registry, and the
@mapcorescope configured on your machine (or see Installing from tarballs only). If you have not done that yet, follow Install for the web first — the tester's engine dependency is@mapcore-scoped, and without that configuration npm looks for it on the public registry and fails with404 … '@mapcore/…' is not in this registry.
1. Download the package tarball
The npm download endpoint is authenticated, so fetch the tarball rather than installing by name. Download it below (you will be prompted to log in) and save the file into a fresh, empty folder:
MapCore 12.5.0. Downloads are credential-gated by Artifactory itself — the first one opens its sign-in page.
Downloads are not available on this network. Ask your administrator where to obtain MapCore releases.
A ready-to-run tester that serves the engine from your machine
The file is named web-tester-<version>.tgz, where <version> is the release shown above. The
Artifactory repository browser lists other versions under web-tester/-/.
2. Install
From the folder containing the .tgz:
npm init -y
npm install ./web-tester-<version>.tgz
npm init -y is not optional. It creates a package.json so the install lands in this folder.
Without it, npm walks up to the nearest ancestor directory that has a package.json and installs
node_modules/ there instead.
This pulls the @mapcore/… engine — including MapCore.wasm — from the MapCore registry.
Installing from tarballs only
Where npm cannot use the MapCore registry — the @mapcore scope is not configured, or the install
machine is offline — download the engine tarball as well, and install both in one command. npm then
takes the engine from the tarball instead of the registry. The engine must be the exact package and
version web-tester names; to see which, run:
tar -xzOf web-tester-<version>.tgz package/package.json
and read its dependencies (for example "@mapcore/wasm-32": "<version>"). Download that
engine into the same folder:
MapCore 12.5.0. Downloads are credential-gated by Artifactory itself — the first one opens its sign-in page.
Downloads are not available on this network. Ask your administrator where to obtain MapCore releases.
Rendering, layers, overlays - the full API
npm i @mapcore/wasm-32@12.5.0
Rendering, layers, overlays - the full API
npm i @mapcore/wasm-64@12.5.0
Spatial queries and geodesy with no renderer, and considerably smaller
npm i @mapcore/wasm-calculations-32@12.5.0
Spatial queries and geodesy with no renderer, and considerably smaller
npm i @mapcore/wasm-calculations-64@12.5.0
Then, from that folder:
npm init -y
npm install ./wasm-32-<version>.tgz ./web-tester-<version>.tgz
3. Run
npx web-tester
Then open http://localhost:8080. To use a different port, set PORT first:
# Windows (cmd)
set PORT=3000&& npx web-tester
# PowerShell
$env:PORT=3000; npx web-tester
# bash
PORT=3000 npx web-tester
Stop the server with Ctrl+C.
Where the engine files land
The engine package installs under node_modules/@mapcore/<engine>/ — for example
node_modules/@mapcore/wasm-32/MapCore.wasm. The server locates it through Node module resolution
and serves it under /mapcore, so it is found regardless of how npm hoists the dependency.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
404 … '@mapcore/…' is not in this registry | The @mapcore:registry line is missing, or the .npmrc holding it is not being read. | Add the scope line to your user .npmrc — see Install for the web. Confirm with npm config get @mapcore:registry. |
401 / 403 fetching @mapcore/… | Missing or expired auth token. | Regenerate the token and update .npmrc. |
npx web-tester prints engine /mapcore -> (@mapcore/… NOT FOUND …) | The engine package is not installed next to web-tester. | Install web-tester from the MapCore registry, or install the engine tarball with it — see Installing from tarballs only. |
node_modules/ appeared in a parent directory | Installed in a folder with no package.json. | Run npm init -y in the target folder first (step 2). |