Ember-CLI 为 jQuery 和 QUnit 使用了错误的路径

Ember-CLI uses wrong path for jQuery and QUnit

我正在使用以下版本的 ember-cli 的全新安装:

~/Projects/ember_tut > ember s
version: 1.13.13
node: 4.2.1
npm: 2.14.10
os: darwin x64

bower.json 看起来像这样:

{
  "name": "ember-tut",
  "dependencies": {
    "ember": "1.13.11",
    "ember-cli-shims": "0.0.6",
    "ember-cli-test-loader": "0.2.1",
    "ember-data": "1.13.15",
    "ember-load-initializers": "0.1.7",
    "ember-qunit": "0.4.16",
    "ember-qunit-notifications": "0.1.0",
    "ember-resolver": "~0.1.20",
    "jquery": "^1.11.3",
    "loader.js": "ember-cli/loader.js#3.4.0",
    "qunit": "~1.20.0",
    "pretender": "~0.10.1",
    "lodash": "~3.7.0",
    "Faker": "~3.0.0"
  }
}

紧接着 运行 ember new ember_test:

~/Projects/ember_tut > ember s
version: 1.13.13
Livereload server on http://localhost:49154
Serving on http://localhost:4200/
ENOENT: no such file or directory, stat '/Users/sms/Projects/ember_tut/tmp/concat_with_maps-input_base_path-pmZyxQ2F.tmp/0/bower_components/jquery/dist/jquery.js'
Error: ENOENT: no such file or directory, stat '/Users/sms/Projects/ember_tut/tmp/concat_with_maps-input_base_path-pmZyxQ2F.tmp/0/bower_components/jquery/dist/jquery.js'
    at Error (native)
    at Object.fs.statSync (fs.js:849:18)
    at ConcatWithMaps.keyForFile (/Users/sms/Projects/ember_tut/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/node_modules/broccoli-caching-writer/index.js:90:20)
    at Array.map (native)
    at ConcatWithMaps.CachingWriter._conditionalBuild (/Users/sms/Projects/ember_tut/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/node_modules/broccoli-caching-writer/index.js:112:65)
    at /Users/sms/Projects/ember_tut/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/read_compat.js:61:34
    at lib$rsvp$$internal$$tryCatch (/Users/sms/Projects/ember_tut/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/sms/Projects/ember_tut/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:505:17)
    at lib$rsvp$$internal$$publish (/Users/sms/Projects/ember_tut/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:476:11)
    at lib$rsvp$asap$$flush (/Users/sms/Projects/ember_tut/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1198:9)

它正在 bower_components/jquery/dist/jquery.js 中寻找 jquery.js 但它确实在 bower_components/jquery/jquery-1.11.3/dist/jquery.js 中。

这很容易 "fixed" 通过在 bower_components/jquery/ 中创建到 bower_components/jquery/jquery-1.11.3/dist 的符号链接,但这非常笨拙,我想知道解决它的正确方法是什么。

我发现删除所有 npm 和 bower 缓存,然后重新安装一切都有效,这让我觉得 nem 在评论中的建议非常接近:

npm cache clear && bower cache clean && rm -rf node_modules bower_components && npm install && bower install