I have created Phoenix 1.0.4 (Elixir) application. After I had added some logic in application I wanted to switch my work for front-end part. On page http://www.jonathanbirkholz.com/how-to-use-font-awesome-on-phoenix/ I read that for 3rd assets I should use Bower. Unfortunately with font-awesome
or bootstrap-sass
from Bower and with command brunch build
I always receive:
/.../my_app/node_modules/acorn/dist/acorn.js:1747
throw err;
^
SyntaxError: Unexpected token (2:10)
at Parser.pp.raise (/.../my_app/node_modules/acorn/dist/acorn.js:1745:13)
at Parser.pp.unexpected (/.../my_app/node_modules/acorn/dist/acorn.js:2264:8)
at Parser.pp.semicolon (/.../my_app/node_modules/acorn/dist/acorn.js:2243:59)
at Parser.pp.parseExpressionStatement (/.../my_app/node_modules/acorn/dist/acorn.js:2677:8)
at Parser.pp.parseStatement (/.../my_app/node_modules/acorn/dist/acorn.js:2462:160)
at Parser.pp.parseBlock (/.../my_app/node_modules/acorn/dist/acorn.js:2692:21)
at Parser.pp.parseStatement (/.../my_app/node_modules/acorn/dist/acorn.js:2443:19)
at Parser.pp.parseTopLevel (/.../my_app/node_modules/acorn/dist/acorn.js:2379:21)
at Object.parse (/.../my_app/node_modules/acorn/dist/acorn.js:101:12)
at parse (/.../my_app/node_modules/detective/index.js:9:18)
at Function.exports.find (/.../my_app/node_modules/detective/index.js:44:15)
at module.exports (/.../my_app/node_modules/detective/index.js:23:20)
at /.../my_app/node_modules/deppack/index.js:83:12
at tryToString (fs.js:414:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:401:12)
I found that problem is caused by acorn - JavaScript library, so I check dependency tree for Node modules:
├─┬ brunch@2.0.4
│ ├─┬ deppack@0.1.5
│ │ └─┬ detective@4.3.1
│ │ ├── acorn@1.2.2
Brunch 2.0.4 (The newest released) use dependencies for old acorn library. There are newer acorn versions, but detective library allows to use acorn 1.x.x versions.z
Probably I found what was wrong. Bower must be installed globally and shouldn't exist locally (in node_modules).
I had a similar issue.
Try using Node > 5 and NPM 3, clean your cache and install the node_modules again (delete first).