简体   繁体   English

Bigcommerce bundle.js模具主题发生错误

[英]Error with Bigcommerce bundle.js stencil theme

I'm having some trouble working with the Bigcommerce stencil framework locally. 我在本地使用Bigcommerce模具框架时遇到了一些麻烦。 I can get everything running properly, but when the page loads I get the following error: 我可以使一切正常运行,但是在页面加载时出现以下错误:

Uncaught TypeError: url.indexOf is not a function
    at jQuery.fn.init.jQuery.fn.load (eval at <anonymous> (bundle.js:1835), <anonymous>:9793:13)
    at Object.init (eval at <anonymous> (bundle.js:1907), <anonymous>:345:17)
    at HTMLDocument.eval (eval at <anonymous> (bundle.js:1907), <anonymous>:727:23)
    at Function.each (eval at <anonymous> (bundle.js:1835), <anonymous>:368:19)
    at jQuery.fn.init.each (eval at <anonymous> (bundle.js:1835), <anonymous>:157:17)
    at jQuery.fn.init.$.fn.foundation (eval at <anonymous> (bundle.js:1907), <anonymous>:726:17)
    at exports.default (eval at <anonymous> (bundle.js:2063), <anonymous>:6:14)
    at Global.loaded (eval at <anonymous> (bundle.js:2249), <anonymous>:99:34)
    at eval (eval at <anonymous> (bundle.js:1841), <anonymous>:718:13)
    at iterate (eval at <anonymous> (bundle.js:1841), <anonymous>:262:13)

I used this post jquery 3.0 url.indexOf error to change the $(window).load(function... to $(window).on('load', function... like it said and that seemed to fix the problem. 我使用这篇文章jquery 3.0 url.indexOf错误$(window).load(function...更改$(window).on('load', function...就像它说的那样,这似乎可以解决问题。

However, the bundle.js file get recreated everytime you load the page and it automatically generates $(window).load(function which is what is causing the problem. 但是,每次加载页面时都会重新创建bundle.js文件,它会自动生成$(window).load(函数,这就是导致此问题的原因。

Does anyone know where I can find where this is getting generated so i can make sure it loads the proper $(window).on('load', function... INSTEAD of the $(window).load(function... 有谁知道我在哪里可以找到生成的内容,因此我可以确保它加载正确的$(window).on('load', function... INSTEAD of $(window).load(function...

Let me know if you need anything else. 需要帮助请叫我。

Thank you. 谢谢。


**** Below was added 01-09-2017 **** ****下面添加了2017/01/09 ****


I had someone install stencil locally and download the theme onto their computer and they didn't get any errors, and the page was working perfectly fine. 我让某人在本地安装模具并将主题下载到他们的计算机上,他们没有收到任何错误,并且页面运行正常。 I had him upload the file in the bigcommerce backend and apply it to the store since it was now working. 我让他将文件上传到bigcommerce后端,然后将其应用于商店,因为它现在可以正常工作了。 I then downloaded the theme that was now working, and ran it locally on my computer and am getting the error again. 然后,我下载了现在可以使用的主题,并在我的计算机上本地运行了该主题,再次遇到错误。 Since I'm getting the error with this theme and the other person isn't, I assume that one of libraries i'm using are old and need to be updated. 由于我在使用此主题时遇到错误,而其他人则没有,因此我认为我正在使用的一个库较旧,需要更新。 What do you think? 你怎么看?

Thank you everyone for your help. 感谢大家的帮助。 Since I was getting the error and the person who freshly installed stencil offline today wasn't, I assumed it had something to do with my dependencies being out of date. 由于我遇到了错误,而今天刚脱机安装模具的人却没有,我认为这与我的依赖关系过时有关。 I did the following and it solved the problem: 我做了以下工作,它解决了问题:

  1. open git bash in the stencil directory stencil目录中打开git bash
  2. run npm install && jspm install 运行npm install && jspm install
  3. run stencil init 运行stencil init
  4. after stencil init runs, navigate to /assets/js and delete the bundle.js file. stencil init运行后,导航至/ assets / js并删除bundle.js文件。
  5. rerun stencil init 重新运行stencil init
  6. run stencil start 运行stencil start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM