Read the statement by Michael Teeuw here.
MMM-Stock Cannot read property 'toLowerCase'
-
Stock module used to run just fine, now I am given this error when pulling up ‘npm start dev’ can anyone offer any guidance on how to fix this?
-
@brendan_c23 usually this happens when a module retrieves data and EXPECTS success, but never really checks, or the data changes format.
this specific error is related to a string (“abcdefgh”) and wanting to convert all the chars to lowercase before comapring… BUT the string didn’t get created…
in json data its like this
if(json_data.key.toLowerCase() ==‘test’)
but the item changed name to Key, so its undefined.toLowercase()…or key is not a string anymore,
but an object {}net, the code has to change
-
@sdetweil Could you help guide me on how to fix the code? Would you like me to post the .js file?
-
@brendan_c23 which module is that
this one works fine (with the example stocks)
-
@brendan_c23 ok, I see the error on refresh…
change line 90 from
if(this.config.currency.toLowerCase() != "usd"){
to
if(that.config.currency.toLowerCase() != "usd"){
-
@sdetweil Hey I tried that, now it says Cannot read property ‘toLowerCase’ of undefined at MMM-stock.js:90
Any other suggestions?u are only changing the word this to the word that on that one line
-
@brendan_c23 Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined
-
@brendan_c23 you are only changing one word
‘this’ to the word ‘that’ on one line -
@sdetweil Yes I made that change, but the error was still coming up for me
-
@brendan_c23 show me those 10 lines