gulp-template icon indicating copy to clipboard operation
gulp-template copied to clipboard

Cryptic error on template parse error - not enough details provided to properly track down the issue

Open arimus opened this issue 8 years ago • 3 comments

I got the following error which was less than simple to track down. I had to comment out blocks at a time in a template that was being parsed in Angular2 until I narrowed it down. It turned out to be that in my template I had:

${{removeContribution.amount}}

instead of

{{removeContribution.amount}}

A typo on my part, however it'd be great to die with a more sensical error that perhaps even pointed out the where. I had to modify the source code to dump the file it was parsing, so I could determine which template it was dying on...then proceed to figure out why.

/Users/arimus/workspace/project/node_modules/gulp-template/node_modules/lodash/lodash.js:487 case 0: return func.call(thisArg); ^ SyntaxError: Unexpected token . at /Users/arimus/workspace/project/node_modules/gulp-template/node_modules/lodash/lodash.js:14776:16 at apply (/Users/arimus/workspace/project/node_modules/gulp-template/node_modules/lodash/lodash.js:487:27) at /Users/arimus/workspace/project/node_modules/gulp-template/node_modules/lodash/lodash.js:15160:16 at apply (/Users/arimus/workspace/project/node_modules/gulp-template/node_modules/lodash/lodash.js:489:27) at /Users/arimus/workspace/project/node_modules/gulp-template/node_modules/lodash/lodash.js:6558:16 at template (/Users/arimus/workspace/project/node_modules/gulp-template/node_modules/lodash/lodash.js:14775:20) at DestroyableTransform._transform (/Users/arimus/workspace/project/node_modules/gulp-template/index.js:21:14) at DestroyableTransform.Transform._read (/Users/arimus/workspace/project/node_modules/readable-stream/lib/_stream_transform.js:159:10) at DestroyableTransform.Readable.read (/Users/arimus/workspace/project/node_modules/readable-stream/lib/_stream_readable.js:357:10) at flow (/Users/arimus/workspace/project/node_modules/readable-stream/lib/_stream_readable.js:727:26)

arimus avatar Nov 09 '16 23:11 arimus

Pull request welcome :)

sindresorhus avatar Feb 05 '17 18:02 sindresorhus

Any updates on this?

We are experiencing the same problem using angular-seed here https://github.com/mgechev/angular-seed/issues/1498 and here https://github.com/mgechev/angular-seed/issues/1892

Flood avatar May 08 '17 11:05 Flood

Same issue here

drosi94 avatar May 16 '17 09:05 drosi94