简体   繁体   中英

Ember CLI - Uncaught Error: Could not find module ember?

I am converting an old school Ember app (built with grunt) into Ember CLI, and I'm facing an odd issue I can't seem to resolve.

When I launch the app with Ember serve and access it in the browser, I get two errors:

Uncaught Error: Could not find module handlebars
Uncaught Error: Could not find module ember

I have no clue on what to look for as I'm importing handlebars and ember in Broccoli, supposedly with the right syntax.

Here is my Broccoli.js :

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp();

app.import('bower_components/jquery/dist/jquery.js');
app.import('bower_components/handlebars/handlebars.js');
app.import('bower_components/jquery-validation/dist/jquery.validate.js');
app.import('bower_components/jquery-validation/dist/additional-methods.js');
app.import('bower_components/recaptcha-ajax/recaptcha_ajax.js');
app.import('bower_components/noty/js/noty/packaged/jquery.noty.packaged.js');
app.import('bower_components/d3/d3.min.js'); 
app.import('vendor/noty/noty-custom-theme.js');

app.import({
    development: 'bower_components/ember/ember.js',
    production:  'bower_components/ember/ember.prod.js'
 });

module.exports = app.toTree();

In the app I import Ember using standard ES6 syntax:

import Ember from 'ember';

export default Ember.Route.extend({
   ...
});

Here is what by bower list looks like:

application
├─┬ bootstrap-sass-official#3.3.1
│ └── jquery#2.1.1
├── d3#3.4.13
├─┬ ember#1.9.0-beta.4
│ ├── handlebars#2.0.0
│ └── jquery#2.1.1
├─┬ ember-c3#0.1.3
│ ├─┬ c3#0.4.5 (0.4.7 available)
│ │ └── d3#3.4.13
│ ├── ember#1.9.0-beta.4
│ └── handlebars#2.0.0 incompatible with ^1.3.0 (1.3.0 available, latest is 2.0.0)
├─┬ ember-cli-shims#0.0.3
│ └── ember#1.9.0-beta.4
├── ember-cli-test-loader#0.0.4
├─┬ ember-data#1.0.0-beta.12
│ └── ember#1.9.0-beta.4
├─┬ ember-load-initializers#0.0.2
│ └── ember#1.9.0-beta.4
├─┬ ember-qunit#0.1.8
│ ├── ember#1.9.0-beta.4
│ └── ember-data#1.0.0-beta.12
├─┬ ember-qunit-notifications#0.0.4
│ └── qunit-notifications#0.0.3
├─┬ ember-resolver#0.1.10
│ └── ember#1.9.0-beta.4
├── fontawesome#4.2.0
├─┬ fuelux#3.3.1
│ ├─┬ bootstrap#3.2.0 (latest is 3.3.1)
│ │ └── jquery#2.1.1
│ ├── jquery-1.11.0#1.11.0 (latest is 2.1.1)
│ ├── moment#2.7.0 (latest is 2.8.4)
│ └── requirejs#2.1.15
├── handlebars#2.0.0
├── jquery#2.1.1
├─┬ jquery-validation#1.13.1
│ └── jquery#2.1.1
├── loader.js#2.1.1
├── noty#2.3.2
├── qunit#1.15.0
└── recaptcha-ajax#ea58c14d98

I tried:

Here are the versions:

$ ember version --verbose
version: 0.1.2
http_parser: 1.0
node: 0.10.33
v8: 3.14.5.9
ares: 1.9.0-DEV
uv: 0.10.29
zlib: 1.2.3
modules: 11
openssl: 1.0.1j
npm: 2.1.3

What is going on?

I also opened an issue with ember-cli here: https://github.com/stefanpenner/ember-cli/issues/2636

Any pointers will be greatly appreciated!

Thanks!

It turns out that was a bug on Ember CLI 0.1.3. I opened a ticket here: https://github.com/stefanpenner/ember-cli/issues/2636

Version 0.1.4 also doesn't work on Windows due to other bug on Windows.

If you encounter this, use version 0.1.2 (which works) or try a more recent one if that exists when you hit the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM