余烬服务器不断抱怨找不到文件



这让我发疯了。我在一台新计算机上克隆了我的项目,运行了npm installbower install,但随后运行ember server一直告诉我它找不到我的时刻.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:Devstarnode_modulesember-clinode_modulesbroccoli-kitchen-sink-helpersindex.js:202:13)

我的 Brocfile 有这样一行: app.import(app.bowerDirectory + '/moment/moment.js');这正是文件所在的位置。

我什至刚刚将 ember-cli 升级到最新版本,遵循所有内容,清除 tmp 和 dist 文件夹,重新运行 npm 和 bower 安装,但仍然收到此错误。就像它不是从 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]);

我发现了问题。它是 ember-pikaday node_module,它有自己的 Brocfile 和一个索引.js两者都会做一个app.import并寻找一个"momentjs"文件夹。我只是假设添加的组件是兼容的,但我想我学到了一些东西。

相关内容

  • 没有找到相关文章