本文介绍了获取“未捕获错误:断言失败:Ember Views需要1.7和2.1之间的jQuery”通过ember-cli创建应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Ember开始。我按照上的入门指南,并通过运行以下命令设法创建一个新的ember应用程序:

  npm install -g ember-cli 
ember new sample-app

一切顺利,我可以看到ember-cli生成的应用程序文件。不久之后,我做了:

  ember server 

命令行显示:

 版本:1.13.13 
Livereload服务器http:// localhost:49153
服务于http:// localhost:4200 /

构建成功 - 4426ms。

最慢的树|总计
--------------------------------------------- - + ---------------------
ConcatWithMaps:Concat:Vendor | 3498ms

最慢的树(累积)|总计(平均)
------------------------------------------ ---- + ---------------------
ConcatWithMaps:Concat:Vendor(1)| 3498ms

当我去。没有任何东西被加载,Chrome控制台显示以下内容:

 未捕获错误:断言失败:Ember Views需要1.7到2.1之间的jQuery 
未捕获错误:无法从`sample-app / app`导入的模块`ember`

我尝试通过重新安装ember-cli,bower和npm来解决这个问题,但没有任何工作。



这是额外的信息,如有必要:

  $ ember -v 
版本:1.13.13
节点:5.4.0
npm:2.14.10
os:darwin x64

$ npm -v
3.5.3

$ bower -v
1.7.2

帮助非常感谢。感谢提前!

解决方案

这是一个bug,由于一个新版本的jQuery,这个ember还不能处理。现在您可以更改 bower.json 文件中的以下行。然后运行 bower install ,它应该可以工作。

 jquery: ^ 1.11.3,

 jquery:1.11.3,

新版本的ember.js是,应该修复。


I'm starting with ember. I followed the Getting Started guide at emberjs.com and managed to create a new ember application by running the following commands:

npm install -g ember-cli
ember new sample-app

Everything went successful and I can see the app files generated by ember-cli. Soon after that I did:

ember server

The command line shows:

version: 1.13.13
Livereload server on http://localhost:49153
Serving on http://localhost:4200/

Build successful - 4426ms.

Slowest Trees                                 | Total               
----------------------------------------------+---------------------
ConcatWithMaps: Concat: Vendor                | 3498ms              

Slowest Trees (cumulative)                    | Total (avg)         
----------------------------------------------+---------------------
ConcatWithMaps: Concat: Vendor (1)            | 3498ms 

The problem comes when I go to http://localhost:4200. Nothing gets loaded and the Chrome console is showing the following:

Uncaught Error: Assertion Failed: Ember Views require jQuery between 1.7 and 2.1
Uncaught Error: Could not find module `ember` imported from `sample-app/app`

I tried to fix this by reinstalling ember-cli, bower and npm but nothing is working.

Here's additional info in case is necessary:

$ ember -v
version: 1.13.13
node: 5.4.0
npm: 2.14.10
os: darwin x64

$ npm -v
3.5.3

$ bower -v
1.7.2

Help is much appreciated. Thanks in advance!

解决方案

This is a bug due to a new version of jQuery which ember is not yet able to handle. For now you can change the following line in your bower.json file. Then run bower install and it should work.

"jquery": "^1.11.3",

to

"jquery": "1.11.3",

A new version of ember.js is imminent which should fix this.

这篇关于获取“未捕获错误:断言失败:Ember Views需要1.7和2.1之间的jQuery”通过ember-cli创建应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 19:41