找不到“应用程序”模板或视图。什么都不会被渲染Object {fullName:“template:application”}

时间:2014-10-09 19:20:10

标签: javascript ember.js handlebars.js ember-cli

我最近将ember-cli项目从0.0.44更新为0.1.1,突然我的模板不再加载,而是在控制台上收到以下警告:

Could not find "application" template or view. Nothing will be rendered Object {fullName: "template:application"}

Could not find "index" template or view. Nothing will be rendered Object {fullName: "template:index"}

我更新项目的步骤只是:

npm install --save-dev ember-cli
ember init

这是我的路由器:

import Ember from 'ember';
import config from './config/environment';

var Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('login');
  this.route('permission');
  this.route('user');
  this.route('room');
  this.route('room/new');
});

Router.reopen({
  notifyGoogleAnalytics: function() {
    return window.ga('send', 'pageview', {
      'page': this.get('url'),
      'title': this.get('url')
    });
  }.on('didTransition')
});

export default Router;

这是我的app.js

import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';

Ember.MODEL_FACTORY_INJECTIONS = true;

var App = Ember.Application.extend({
  modulePrefix: config.modulePrefix,
  autoprefixer: {
    browsers: ['> 1%', 'last 1 version', 'android 4', 'ios 6']
  },
  podModulePrefix: config.podModulePrefix,
  Resolver: Resolver
});

loadInitializers(App, config.modulePrefix);

export default App;

任何帮助?

2 个答案:

答案 0 :(得分:13)

这应该有所帮助:

npm cache clear
bower cache clean
rm -rf dist tmp bower_components node_modules
npm install
bower install

答案 1 :(得分:0)

好吧,我不得不说我尝试了@quaertym解决方案,这给我带来了很多问题。对于其他人来说,这个命令可能会有所帮助:

rm -rf dist tmp bower_components node_modules

在OSX和Linux中运行良好,但文档中说https://ember-cli.com/user-guide/#upgrading

对于Windows,请使用此命令。

rd /s /q node_modules bower_components dist tmp