Ember server keeps complaining about a file not found

1.2k Views Asked by At

This is driving me nuts. I cloned my project on a new computer, ran npm install and bower install, but then running ember server keeps telling me that it can't find my moment.js file, but I have the correct path in my Brocfile. I had to change the Brocfile after the bower install because the folder changed from "momentjs" to just "moment," but it looks like it's still looking in the old place. I've also cleared both bower's and npm's caches. Here's the error:

$ ember server
version: 0.1.4
Could not find watchman, falling back to NodeWatcher for file system events
Livereload server on port 35729
Serving on http://0.0.0.0:4200/
Path or pattern "bower_components/momentjs/moment.js" did not match any files
Error: Path or pattern "bower_components/momentjs/moment.js" did not match any files at Object.multiGlob (c:\Dev\star\node_modules\ember-cli\node_modules\broccoli-kitchen-sink-helpers\index.js:202:13)

My Brocfile has this line: app.import(app.bowerDirectory + '/moment/moment.js'); which is exactly where the file is.

I even just upgraded ember-cli to the latest version, followed everything, cleared out the tmp and dist folders, re-ran npm and bower install, and still getting this error. It's like it's not reading from the Brocfile or something.

EDIT: Add brocfile.js:

/* global require, module */

var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var fontAwesome;
var app = new EmberApp({
  vendorFiles: {
    'es5-shim.js': 'bower_components/es5-shim/es5-shim.js',
    'es5-sham.js': 'bower_components/es5-shim/es5-sham.js'
  }
});

//these font files will be put into the assets/fonts folder in public/ and dist/
fontAwesome = pickFiles('vendor/sb-admin-2/font-awesome-4.2.0/fonts', {
  srcDir: '/',
  files: ['*'],
  destDir: '/assets/fonts'
});

// Use `app.import` to add additional libraries to the generated
// output files.

//only using the js and font files from bootstrap, sass stylesheets are in app/styles
app.import('bower_components/moment/moment.js');
app.import(app.bowerDirectory + '/respond/dest/respond.min.js');
app.import(app.bowerDirectory + '/bootstrap-sass-official/assets/javascripts/bootstrap/tooltip.js');
app.import('vendor/sb-admin-2/js/bootstrap.min.js');
app.import(app.bowerDirectory + '/ember-addons.bs_for_ember/dist/js/bs-core.min.js');
app.import(app.bowerDirectory + '/ember-addons.bs_for_ember/dist/js/bs-progressbar.min.js');
app.import(app.bowerDirectory + '/ember-addons.bs_for_ember/dist/js/bs-nav.min.js');
app.import(app.bowerDirectory + '/ember-addons.bs_for_ember/dist/js/bs-badge.min.js');
app.import('vendor/sb-admin-2/js/plugins/metisMenu/metisMenu.js');
app.import('vendor/sb-admin-2/css/plugins/metisMenu/metisMenu.css');
app.import('vendor/sb-admin-2/js/sb-admin-2.js');
//sb-admin-2 scss is imported in app/styles/app.scss
app.import('vendor/sb-admin-2/font-awesome-4.2.0/css/font-awesome.min.css');

//placholder attribute polyfill
app.import(app.bowerDirectory + '/better-dom/dist/better-dom-legacy.js');
app.import(app.bowerDirectory + '/better-dom/dist/better-dom.js');
app.import(app.bowerDirectory + '/better-placeholder-polyfill/dist/better-placeholder-polyfill.js');

// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.

module.exports = mergeTrees([
  app.toTree(),
  fontAwesome]);
1

There are 1 best solutions below

0
On

I found the problem. It was the ember-pikaday node_module that has a Brocfile of its own and an index.js that both do an app.import and look for a "momentjs" folder. I just assumed that added components would be compatible, but I guess I learned something.