Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Standalone ArcGIS JS

See original GitHub issue

When passing an Options object to loadScript using a URL that is pointed at a standalone ArcGIS JS installation, I receive the following error:

TypeError: Cannot read property ‘on’ of undefined

I’m using the npm package create-react-app version 1.1.4 and esri-loader version 2.4.0

The issue only occurs when I point to a local installation of ArcGIS JS. Removing the URL options or pointing it to or works without any problems.

Steps to replicate

  • npm install create-react-app and esri-loader
  • Run npx create-react-app my-test-app
  • Open the App.js that has been generated and replace it with the code below and point the options url to a local ArcGIS JS installation
  • Make sure the dev server is running and visit localhost:3000, open the debug console for your browser
import logo from './logo.svg';
import './App.css';
import * as esriLoader from 'esri-loader';

class App extends Component {
  componentDidMount() {
    var options = {
      url: "http://localhost:13013/4.5/",
      dojoConfig: {
        async: true,
        baseUrl: "http://localhost:13013/4.5/dojo"
    // has the ArcGIS API been added to the page?
    if (!esriLoader.isLoaded()) {
      console.log("Is not Loaded");
      // no, lazy load it the ArcGIS API before using its classes
      esriLoader.loadModules(['esri/Map', 'esri/views/MapView'], options).then(([Map, MapView]) => { 
        var map = new Map({
          basemap: "topo"

        this.view = new MapView({
          container: this.mapContainer,
          map: map

  render() {
    return (
      <div className="App">
        <div style={{height:'100%'}} ref={node => this.mapContainer = node}/>

export default App;

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

DevChagrinscommented, Aug 7, 2018


console.log(“Is not Loaded”);

was the only thing that ran.

@davetimmins Thank you. Replacing the URL with that and leaving my dojoConfig solved my problem! Without the dojoConfig causes it to not work with different errors.

davetimminscommented, Aug 7, 2018

@DevChagrins I’ve used it with a local API using the full dojo.js file path for the url e.g.

var options = {
      url: "http://localhost:13013/4.5/dojo/dojo.js"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Build offline applications | Documentation - ArcGIS Developers
Offline applications run natively on phones, tablets, laptops, or desktop computers, and work where network connectivity is unreliable or unavailable. The data ...
Read more >
Solved: Using the Javascript API, is it possible to downlo...
GitHub - Esri/offline-editor-js: ArcGIS JavaScript library for handling offline editing and tiling. It's not maintained anymore but wanted ...
Read more >
Using ArcGIS webmap offline? - GIS Stack Exchange
The ArcGIS Javascript can be downloaded from My Esri. This will also include instructions on how it can be installed on a local...
Read more >
Esri/offline-editor-js: ArcGIS JavaScript library for ... - GitHub
ArcGIS JavaScript library for handling offline editing and tiling. - GitHub - Esri/offline-editor-js: ArcGIS JavaScript library for handling offline editing ...
Read more >
ArcGIS API for JavaScript: Getting Started with Web ... - YouTube
Join us for an overview on developing with the ArcGIS API for JavaScript. This session will cover the basics of setting up your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found