应用程序本地工作,Heroku中的错误。是因为我的async = false标签吗?

时间:2017-01-21 03:25:44

标签: javascript reactjs heroku

我拿了一个用各种插件编写的模板,并开始将其转换为React。将现有的JavaScript文件转换为在React中工作是我的能力,所以我所做的是:

componentDidMount(){
        var loadScripts = [
            './vendor/jquery/jquery.js',
            './vendor/bootstrap/js/bootstrap.min.js',
            './js/classie.js','./js/cbpAnimatedHeader.js',
            './vendor/jquery.easing/jquery.easing.min.js',
            './vendor/owl-carousel/owl.carousel.js',
            './vendor/magnific-popup/jquery.magnific-popup.min.js',
            './vendor/formstone/core.js',
            './vendor/formstone/transition.js',
            './vendor/formstone/background.js',
            './vendor/mixitup/jquery.mixitup.js',
            './vendor/wow/wow.min.js',
            './js/contact_me.js',
            './js/jqBootstrapValidation.js',
            './js/vitality.js'];

            loadScripts.forEach(function(src) {
                var script = document.createElement('script');
                script.src = src;
                script.async = false;
                document.head.appendChild(script);
            });
        }

它在本地运作完美。当我推到heroku时,我遇到了很多错误。这些错误让我相信文件是异步加载的。 Heroku是否允许使用async = false标记?

以下是错误:

Uncaught TypeError: Cannot read property 'scrollTop' of undefined
    at e (background.js:3)
    at HTMLDocument.c (background.js:3)
    at b (core.js:3)
    at Object.<anonymous> (core.js:3)
    at Object.<anonymous> (jquery.js:3366)
    at fire (jquery.js:3187)
    at Object.add [as done] (jquery.js:3246)
    at Array.<anonymous> (jquery.js:3365)
    at Function.each (jquery.js:365)
    at Object.<anonymous> (jquery.js:3361)
contact_me.js:3 Uncaught TypeError: $(...).jqBootstrapValidation is not a function
    at HTMLDocument.<anonymous> (contact_me.js:3)
    at fire (jquery.js:3187)
    at Object.add [as done] (jquery.js:3246)
    at jQuery.fn.init.jQuery.fn.ready (jquery.js:3496)
    at jQuery.fn.init (jquery.js:2927)
    at jQuery (jquery.js:75)
    at contact_me.js:1
background.js:3 Uncaught TypeError: Cannot read property 'container' of undefined
    at jQuery.fn.init.g (background.js:3)
    at jQuery.fn.init.e (core.js:3)
    at jQuery.fn.init.i (core.js:3)
    at vitality.js:109
    at vitality.js:135

0 个答案:

没有答案