question-mark
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.

"_.pluck is not a function" error

See original GitHub issue

Great JS client, and works really well.

One issue I’ve found is that when using it in the WP Editor area (as part of a JS-fuelled WordPress plugin using React), I get the following console errors:

load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,wp-ajax-response,jquery…:380 Uncaught TypeError: _.pluck is not a functiondetach @ load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,wp-ajax-response,jquery…:380render @ load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,wp-ajax-response,jquery…:380render @ load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,wp-ajax-response,jquery…:416init @ load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,wp-ajax-response,jquery…:417i @ jquery.js:1fireWith @ jquery.js:1ready @ jquery.js:1K @ jquery.js:1
load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,wp-ajax-response,jquery…:419 Uncaught TypeError: _.pluck is not a function

and

load-scripts.php?c=0&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,wp-ajax-response,jquery…:663 Uncaught TypeError: Cannot read property 'hasClass' of undefined

I’ve extensively tested and turned everything else off/on, and only when I remove the node-wpapi library from my webpack file (therefore not including it in my project) do the above errors stop.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
jcicero518commented, Mar 5, 2018

Thanks for this guys. I ran into the same issue ~2 years later making use of lodash’s pluck method in a React / Redux driven WP plugin. I was importing it -

import __ from "lodash";

I’ve been habitually setting “this” to _ in methods, probably from my Angular days, I thought this was the conflict initially. This fixed it:

import ld from "lodash"; let __ = ld.noConflict();

0reactions
kadamwhitecommented, Aug 9, 2019

😁 Glad this issue lives on and helps people!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What happened to Lodash _.pluck? - Stack Overflow
My eyes completely skipped over the fat arrow. Ah well, clips.map(function (clip) { return clip.id }) still isn't so bad I guess ;-)....
Read more >
Uncaught TypeError: _.pluck is not a function causing issues ...
Opening the inspection console in chrome, I get the following error in the log. Uncaught TypeError: _.pluck is not a function at Object....
Read more >
Underscore.js _.pluck Function - GeeksforGeeks
The _. pluck() function is used when we need to extract a list of a given property. Like we have to find out...
Read more >
pluck - RxJS
pluck marble diagram. Given a list of strings or numbers describing a path to a property, retrieves the value of a specified nested...
Read more >
Developers - "_.pluck is not a function" error - - Bountysource
"_.pluck is not a function" error ... Great JS client, and works really well. One issue I've found is that when using it...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found