1

早午餐示例:

$ npm -v
1.2.25
$ brunch -V
1.7.6
$ bower -v
1.2.7
$ brunch new https://github.com/monokrome/brunch-with-grits.git example
...
$ cd example
$ ls
app  bower_components  bower.json  config.coffee  node_modules  package.json  README.md  vendor
$ ls bower_components/
backbone  backbone.babysitter  backbone.marionette.subrouter  backbone.wreqr  jquery  lodash  marionette  underscore
$ brunch build
06 Oct 22:25:49 - info: compiled 9 files into 3 files, copied index.html in 761ms
$ bower install -S https://github.com/whyohwhyamihere/backbone.marionette.subrouter.git
...
$ grep marionette bower.json
    "marionette": "~1.0.4",
    "backbone.marionette.subrouter": "https://github.com/whyohwhyamihere/backbone.marionette.subrouter.git"
    "marionette": {
      "main": "lib/core/backbone.marionette.js"
$ cp bower.json bower.json.orig
$ vi bower.json
...
$ diff bower.json bower.json.orig
47,52d46
<     }, 
<     "backbone.marionette.subrouter": {
<       "main": "backbone.marionette.subrouter.js",
<       "dependencies": {
<         "marionette": "*"
<       }
$ brunch build
/home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:164
    var level = Math.max(pkg.sortingLevel || 0, initial);
                            ^
TypeError: Cannot read property 'sortingLevel' of undefined
    at setLevel (/home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:164:29)
    at /home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:169:7
    at Array.forEach (native)
    at setLevel (/home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:168:10)
    at Array.forEach (native)
    at setSortingLevels (/home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:175:12)
    at sortPackages (/home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:181:10)
    at /home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:211:20
    at /home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:144:7
    at /home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/async-each/index.js:24:44
    at /home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:101:7
    at /home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/read-components/index.js:49:7
    at fs.js:253:14
    at /home/icyrockcom/nvm/v0.11.3/lib/node_modules/brunch/node_modules/init-skeleton/node_modules/rimraf/node_modules/graceful-fs/graceful-fs.js:103:5
    at Object.oncomplete (fs.js:94:15)

任何想法为什么这不起作用?marionette由于包含依赖项,因此不应失败。

4

1 回答 1

0

我遇到了同样的问题,结果我已经brunch在全局和本地安装了。又名,我安装它并npm install -g brunch在我的package.json.

将其从package.json(或全局卸载)中删除,然后重试。

于 2013-11-12T18:44:29.650 回答