To use deck.gl you need

  • Node.js
  • webpack
  • Mapbox Access Key

First, we need Node.js installation. I am using a Windows machine, thus, I used the installation file provided below.

However, I downloaded this months ago. I needed to update my npm by running a PowerShell as an Administrator on Windows and run following commands. You may skip it if you freshly installed npm.

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade

The first one is pretty important. After updating my npm, I tried to run

npm install --save deck.gl luma.gl

as it stated on Uber’s github. However, I received an error saying that:

Refusing to install package with name “deck.gl” under a package also called “deck.gl”. Did you name your project the same as the dependency you’re installing?

This pretty much means, do not try to install it if you are already in the GitHub folder you downloaded. Try to run this code a directory outside the downloaded folder, then navigate back to the folder to run

npm install  # or yarn

This will install all the dependencies so it is going to take a while. Go get some tea! It added 1135 packages to mine in 321 seconds. You can run the examples using:

export MapboxAccessToken={Your Token Here} && npm start

Uber does this a lot. They do not tell you that you need a MapboxAccessToken until you actually need it. If this export function does not work on your machine, it is okay to hard code your Public Mapbox key within app.js file for each application. For instance, ../examples/trips/app.js line 10

// Set your mapbox token here
const MAPBOX_TOKEN = "Your Public Key"; // eslint-disable-line

The way I run examples is that I edit the package.json file under the main folder and replace the part “your_example” with the example you would like to try out.

“start”: “(cd examples/your_example && (path-exists node_modules || npm i) && npm run start-local)”,

Lead Traffic Modeler @Ulteig

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store