这让我疯了。我在新计算机上克隆了我的项目,运行npm install
和bower install
,但是后来运行ember server
一直告诉我它找不到我的moment.js文件,但是我有正确的我的Brocfile中的路径。在bower安装后我不得不更改Brocfile,因为文件夹从“momentjs”变为“moment”,但它看起来仍然在旧的地方。我还清除了bower和npm的缓存。这是错误:
$ 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有这一行:
app.import(app.bowerDirectory + '/moment/moment.js');
这正是文件的位置。
我甚至刚刚将ember-cli升级到最新版本,跟着一切,清除了tmp和dist文件夹,重新运行了npm和bower install,仍然出现了这个错误。这就像它不是从Brocfile中读取的东西。
编辑:添加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]);
答案 0 :(得分:1)
我发现了问题。这是ember-pikaday node_module,它有一个自己的Brocfile和一个index.js,它们都执行app.import
并查找“momentjs”文件夹。我只是假设添加的组件是兼容的,但我想我学到了一些东西。