shopifyslate-shopify

ReferenceError: $ is not defined at dist/assets/theme.js?5556:274 in Shopify Slate theme


I using slate for shopify theme developement. Slate : https://github.com/Shopify/slate

node -v : v10.16.0
npm -v : 6.9.0
slate -v : 0.14.0

Followed follwoing step
1) slate theme mydemo
2) slate build (created dist folder)
3) slate zip (upload this theme on shopify store and get theme id.)
4) set store, password, theme id in config.yml file.
5) slate deploy
6) slate watch

Get error in complied dist folder Uncaught ReferenceError: $ is not defined in dist/assets/theme.js at line number 274 slate.Sections.prototype = $.extend({}, slate.Sections.prototype, {

https://jsrajyaguru.myshopify.com/products/650c-micro-wheelset when I change variation from dropdown price and product image not change due to javascript error.


Solution

  • Be sure the version you're calling in the scripts/vendor.js matches your jQuery version number in the scripts/vendor folder.

    For example after a fresh install of slate in my vendor.js it was:

    /*!
     * jquery-2.2.3.min.js
     */
    // =require vendor/jquery-2.2.3.min.js
    

    and in my vendor folder the version supplied was 3.3.1 so I changed my vendor.js to

    /*!
     * jquery-3.3.1.min.js
     */
    // =require vendor/jquery-3.3.1.min.js