我在网上看到的所有使用这两个的例子都依赖于全局安装Bower,但这对Heroku不起作用 - Bower需要成为应用程序的依赖项,因此列在package.json
.
我package.json
看起来像这样:
{ "repository": { }, "dependencies": { "babel-brunch": "^6.0.0", "brunch": "^2.0.0", "clean-css-brunch": ">= 1.0 < 1.8", "css-brunch": ">= 1.0 < 1.8", "javascript-brunch": ">= 1.0 < 1.8", "uglify-js-brunch": ">= 1.0 < 1.8", "sass-brunch": "^1.9.2", "bower": "1.7.0" }, "scripts": { "postinstall": "./node_modules/bower/bin/bower install" } }
我bower.json
喜欢这样:
{ "name": "Kaderi", "dependencies": { "bootstrap-sass": "~ 3.3.6" } }
但是,在bower
加载时package.json
,我总是在构建资产时遇到以下JS错误:
./node_modules/detective/node_modules/acorn/dist/acorn.js:1747 throw err; ^ SyntaxError: Unexpected token (2:10) at Parser.pp.raise (./node_modules/detective/node_modules/acorn/dist/acorn.js:1745:13) at Parser.pp.unexpected (./node_modules/detective/node_modules/acorn/dist/acorn.js:2264:8) at Parser.pp.semicolon (./node_modules/detective/node_modules/acorn/dist/acorn.js:2243:59) at Parser.pp.parseExpressionStatement (./node_modules/detective/node_modules/acorn/dist/acorn.js:2677:8) at Parser.pp.parseStatement (./node_modules/detective/node_modules/acorn/dist/acorn.js:2462:160) at Parser.pp.parseBlock (./node_modules/detective/node_modules/acorn/dist/acorn.js:2692:21) at Parser.pp.parseStatement (./node_modules/detective/node_modules/acorn/dist/acorn.js:2443:19) at Parser.pp.parseTopLevel (./node_modules/detective/node_modules/acorn/dist/acorn.js:2379:21) at Object.parse (./node_modules/detective/node_modules/acorn/dist/acorn.js:101:12) at parse (./node_modules/detective/index.js:9:18) at Function.exports.find (./node_modules/detective/index.js:44:15) at module.exports (./node_modules/detective/index.js:23:20) at ./node_modules/deppack/index.js:83:12 at tryToString (fs.js:414:3) at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:401:12)
我不知道这是由Bower本身引起的,还是bootstrap-sass/jquery(通过Bower安装)引起的.
如果我使用Bower的全局安装,问题就不会出现,但我的资产无法由Herunch上的Brunch编译(由于缺少Bower依赖性).
事实上,这个问题与安装凤凰应用程序的早午餐相同,不适用于bower资产,我也使用凤凰城,但对我来说,只是通过升级凤凰来解决问题(我不知道这将如何影响无论如何Bower/Brunch).
在这个纠结的JavaScript框架网络中我缺少什么?
编辑:在本地和Heroku上使用nodejs v5.1.1和npm v3.3.12.