简体   繁体   中英

Ember CLI: ENOENT, no such file or directory ember-data.js

I have a new ember-cli app and I'm trying to create a version of TodoMVC with ember-cli version 0.0.32.

In my models/todo.js file I have:

import DS from 'ember-data';

var Todo = DS.Model.extend({
  title: DS.attr('string'),
  isCompleted: DS.attr('boolean')
});

export default Todo;

but when I run ember server I get this error:

version: 0.0.32
Livereload server on port 35729
Serving on http://0.0.0.0:4200
ENOENT, no such file or directory '/<my_path>/tmp/tree_merger-tmp_dest_dir-OWIN6XGL.tmp/ember-data.js'

I've tried:

  • npm cache clear
  • npm install
  • bower install

But didn't seem to do anything.

I figured it out because this barely related question mentioned the 'brocfile.js' file and so I compared my 'brocfile.js' file with the ' brocfile.js ' file in an example ember-cli TodoMVC app and noticed one small difference:

app.import({
  development: 'vendor/ember-data/ember-data.js',
  production:  'vendor/ember-data/ember-data.prod.js'
+}, {
 +  'ember-data': [
 +    'default'
 +  ]
});

The + 's are the changes that need to be made to the 'brocfile.js' file in order to get ember-data to work.

Now run ember server and it should work.

Looks like that ember-cli TodoMVC app doesn't need those lines anymore, and the default ember-cli app doesn't have them either.

I had a similar error to yours, saying "no such file or directory: ....\\ember-dat.js" and it turns out that I just hadn't done import DS from 'ember-data' in app/adapters/application.js.

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