html - 错误 : Could not read config from meta tag in EmberCLI

标签 html ember.js ember-cli meta-tags

我的 EmberCLI 应用程序出现以下错误:无法从名为“my-app-name/config/environment”的元标记中读取配置

我读到它与在 app/index.html 中具有正确的 Handlebars 内容有关,但我把它们都放在那里:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>My app name</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    {{content-for "head"}}
    <link rel="stylesheet" href="assets/vendor.css">
    <link rel="stylesheet" href="assets/my-app-name.css">

    {{content-for "head-footer"}}
  </head>
  <body>
    {{content-for "body"}}

    <script src="assets/vendor.js"></script>
    <script src="assets/my-app-name.js"></script>

    {{content-for "body-footer"}}
  </body>
</html>

我的 config/environment.js 文件是:

/* jshint node: true */

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'my-app-name',
    environment: environment,
    contentSecurityPolicy: { 'connect-src': "'self' https://auth.firebase.com wss://*.firebaseio.com" },
    firebase: 'https://my-app-name.firebaseio.com/',
    baseURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    }
  };

  if (environment === 'development') {
    // ENV.APP.LOG_RESOLVER = true;
    // ENV.APP.LOG_ACTIVE_GENERATION = true;
    // ENV.APP.LOG_TRANSITIONS = true;
    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    // ENV.APP.LOG_VIEW_LOOKUPS = true;
  }

  if (environment === 'test') {
    // Testem prefers this...
    ENV.baseURL = '/';
    ENV.locationType = 'none';

    // keep test console output quieter
    ENV.APP.LOG_ACTIVE_GENERATION = false;
    ENV.APP.LOG_VIEW_LOOKUPS = false;

    ENV.APP.rootElement = '#ember-testing';
  }

  if (environment === 'production') {
  }

  return ENV;
};

我是否缺少元标记? 这也是我的浏览器仅在我通过 firebase 部署应用程序时显示的原因吗: {{content-for “head”}} {{content-for “head-footer”}} {{content-for “body”}} {{content-for “body-footer”}}

enter image description here

谢谢!

最佳答案

Ember 默认将配置数据存储在元标记中。在我的应用程序中,我们选择不存储在元标记中,我认为是因为需要支持 IE8。

您可以在 ember-cli-build.jsbrocfile.js 中添加以下行快速修复此问题:

module.exports = function(defaults) {
  var app = new EmberApp({
    //...
  });
  app.options.storeConfigInMeta = false;
});

您可以在这里阅读更多内容: https://github.com/ember-cli/ember-cli/pull/2298

关于html - 错误 : Could not read config from meta tag in EmberCLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38306685/

相关文章:

ajax - 我在哪里可以在 Ember 中放置全局 ajax 错误处理?

html - 媒体查询在第一个屏幕有效,但在下一个屏幕无效

css - Html5 中的 iframe 布局

javascript - Ember 计算属性和 Handlebars 模板

ember.js - 如何处理 Ember 中不存在的动态段的请求?

javascript - 如何在多对多关系中使用复选框?

javascript - 为什么每次更改地址栏中的 URL 时我的当前客户端服务都会重建?

html - 在 http 页面上提供 https 视频

javascript - 检查我的代码中按钮网格的背景颜色

javascript - 有没有办法用 Handlebars 来控制日志日期(时间戳)