I've been using numeraljs for component development and I've been testing with LockerService on today and I'm getting the following error:

Uncaught TypeError: Cannot read property 'numeral' of undefined throws at /resource/XXXXXXXXXXXXX/numeraljs/numeral.js:855:46

Now even with this error the page is working fine. It is just annoying to have errors on the page and not know how to fix them. The app is hosted in a VisualForce page using Lightning Out:

<apex:includeLightning />

$Lightning.use("c:myApp", function() {

In my component I import the script with Lightning require from a static resource:

<ltng:require scripts="{!$Resource.numeraljs + '/numeral.js'}" />

I'm fairly sure it has something to do with window, SecureWindow, and the way numeraljs is initiated

  • 1
    Having trouble reproducing this. Are you using the latest version of numeral.js? Does the error happen on load or while using the app? Jan 5, 2017 at 2:37
  • I'm using the latest numeraljs and it does indeed happen on load. There error doesn't show up in console it shows up at the bottom of the page in the footer area.
    – WarbleSync
    Jan 5, 2017 at 14:10
  • Here's a screen cap of the error and where it appears: imgur.com/a/h0fvn
    – WarbleSync
    Jan 5, 2017 at 14:18
  • 1
    Just double checked my version ... looks like 2.1.4 is the latest and that doesn't produce the error! Happy camper! Thanks for the help Trevor Bliss
    – WarbleSync
    Jan 5, 2017 at 14:32
  • Awesome! I'd recommend putting that as the answer and accepting it to help out others. Jan 5, 2017 at 17:20

1 Answer 1


For future searchers.. as @WawrbleSync points out, the latest version of Numeral.js (2.0.4) is LockerService compliant and loads fine with LockerService enabled.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .