I am getting a JavaScript type error in Minicart, Product view page, and Checkout page.

TypeError: $.widget is not a function

How can I solve this?

  • Have you run deploy command? Jun 27, 2016 at 7:10
  • Yes i am run deploy command but still getting error.
    – Nikul
    Jun 27, 2016 at 9:32
  • you have to first remove pub/static folder content after you have to run command for deploy Jun 27, 2016 at 9:42
  • Hi Rakesh Any command to remove pub/static folder using command.
    – Nikul
    Jun 28, 2016 at 10:02
  • you have to remove manually Jun 28, 2016 at 10:19

3 Answers 3


I had the same problem using Porto Theme. In my case sometimes jQuery was recognized, sometimes not. Unfortunately, I didn't understand the cause, but I found a solution.

In short: Merge all javascript files.

  1. In Backend go to:

Stores -> Configuration -> Advanced -> Developer -> JavaScript Settings

  1. Activate:

    • Enable JavaScript Bundling
    • Merge JavaScript Files
    • Minify JavaScript Files (Optional)
  2. Irecommendedened to deploy the static files

bin/magento setup:static-content:deploy

  1. Clear cache under System -> Cache Management

    • In Additional Cache Management region choose the Button Flush CSS/Javascript Cache
    • And Flush Magento Cache afterwards

Now clear Cache in Browser and reload.

For developing this solution is not satisfying, but at least for productive, use it should be a good working solution, without unpredictable behavior.

Hope it helps..

  • that helped me, thank you. I had the same issue
    – bourax
    Feb 16, 2018 at 10:15
  • I only did the CSS/Javascript & Magento Cache flush, and worked, but your answer can help other cases ! In dev env. we are bound to leave the JS optimizations disabled, debugging becomes hard otherwise, and also rarely use the deploy command, the page refresh triggers this static file generation. Thank you !
    – medmek
    Dec 18, 2018 at 14:14
  • I think this has something to do with requirejs-config.js ... sometimes map: { '*': { is used, and sometimes paths: { ...
    – Black
    Jan 8, 2020 at 15:27

I had this issue as well but then I ran across this article: http://www.danjoseph.me/2016/09/16/magento-2-widget-not-function/

In the article he explains that jquery was being loaded a second time on the page and therefore overwriting the version loaded previously by magento. For me it was a marketing script that was also loading jquery for some reason. jQuery should only be loaded once in the head by this tag and all others should be removed.

<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="jquery" src="http://seatup.local/pub/static/frontend/Seatup/theme/en_US/jquery.js"></script>


Go to your theme folder and locate the following file in Magento_Theme folder


and replace

<script src="jquery.js" />


<remove src="jquery.js" />

Make sure you clean the cache and refresh the page.

I had the same issue and got it resolved using above method.

  • Doing this you are removing jQuery. It's true that solves the error described on the question but now other things are broken for example related of bootstrap. Uncaught Error: Bootstrap's JavaScript requires jQuery at bootstrap.min.js:6
    – Marc Pont
    Jul 24, 2017 at 11:07
  • Removing jQuery is not the correct way to handle this. It is bad advise.
    – Cypher909
    Nov 27, 2017 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.