简体   繁体   English

流星错误:无此功能:仅在生产模式下

[英]Meteor Error: No such function: only in production mode

My App is running perfectly in debug mode but when I run it in production mode I get: 我的应用程序在调试模式下运行完美,但是在生产模式下运行时,我得到:

Error: No such function: canAddMore 错误:无此类功能:canAddMore

Here is the JS code I have: 这是我拥有的JS代码:

Template.fbRegister.helpers({
    jobCount: function() {
        return Session.get("jobCount");
    },

    eduCount: function() {
        return Session.get("eduCount");
    },

    moreThanOneJob: function() {
        return Session.get('jobCount').length > 1
    },

    moreThanOneEdu: function() {
        return Session.get('eduCount').length > 1
    },

    canAddMore: function(count) {
        console.log(count)
        return count.length <= 2
    },
});

And here is the HTML code: 这是HTML代码:

{{#if canAddMore jobCount}}<a class="normal-link add-job">+ Add another Job</a>{{/if}}

What am I doing wrong here? 我在这里做错了什么?

Your code probably breaks in production, due to several missing semicolons . 由于缺少几个分号 ,您的代码可能会中断生产。 When deploying your Meteor application, your code will be minified . 部署Meteor应用程序时,您的代码将被缩小 During this process, blank lines will be removed and therefore it would be no longer possible to distinguish when a statement ends. 在此过程中,空白行将被删除,因此不再可能区分语句何时结束。

Please try: 请试试:

Template.fbRegister.helpers({
    jobCount: function () {
        return Session.get("jobCount");
    },
    eduCount: function () {
        return Session.get("eduCount");
    },
    moreThanOneJob: function () {
        return Session.get('jobCount').length > 1;
    },
    moreThanOneEdu: function () {
        return Session.get('eduCount').length > 1;
    },
    canAddMore: function (count) {
        console.log(count);
        return count.length <= 2;
    }
});

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

相关问题 流星路由器在开发模式下工作,但不在生产模式下工作 - Meteor router working in dev mode but not in production mode 包含的jQuery在生产模式下不起作用引发`not a function`错误 - Included jQuery not works under production mode raise `is not a function` error Meteor - 如何在开发或生产中使用包 - Meteor - How to Use a Package in Dev or Production Only 尝试在生产中编译时出现Meteor UglifyJS错误 - Meteor UglifyJS error when trying to compile in production 仅在生产中出现Javascript错误 - Javascript error in production only “Uncaught TypeError:undefined不是函数”错误只发生在生产中 - 而不是在开发中 - “Uncaught TypeError: undefined is not a function” error only happens in production — not in development 在webpack生产模式下发生错误,但在开发模式下运行良好 - An error happens in webpack production mode, but but works well at development mode Meteor.js Spiderable和Iron Router - 生产服务器上的光纤错误 - Meteor.js Spiderable and Iron Router - fiber error on production server 反应应用程序:仅在生产中从箭头 function 调用箭头 function 会导致错误 - React app: Calling arrow function from arrow function ONLY in production causes error Passport身份验证请求路由仅在Node App的生产模式下不起作用 - Passport authentication request route not working only in production mode for Node app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM