Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

nunjucks Unexpected token ILLEGAL #248

Closed
huguangju opened this issue Feb 21, 2016 · 7 comments
Closed

nunjucks Unexpected token ILLEGAL #248

huguangju opened this issue Feb 21, 2016 · 7 comments

Comments

@huguangju
Copy link

reported error:

gulp-notify: [Error running Gulp] SyntaxError in plugin 'gulp-nunjucks'
Unexpected token ILLEGAL
/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/ttf2woff2/jssrc/ttf2woff2.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB;var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFile

Template render error: (unknown path)
  TypeError: must start with number, buffer, array or string
    at Object.exports.withPrettyErrors (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/nunjucks/src/lib.js:33:17)
    at Obj.extend.render (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/nunjucks/src/environment.js:344:20)
    at Obj.extend.renderString (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/nunjucks/src/environment.js:231:21)
    at Object.module.exports.renderString (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/nunjucks/index.js:66:14)
    at Transform._transform (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/gulp-nunjucks-render/index.js:29:18)
    at Transform._read (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/gulp-nunjucks-render/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at Transform._write (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/gulp-nunjucks-render/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/gulp-nunjucks-render/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/gulp-nunjucks-render/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at Transform.Writable.write (/Users/hugo/programming/github/node-resources/gulp-starter/node_modules/gulp-nunjucks-render/node_modules/readable-stream/lib/_stream_writable.js:194:11)

I just add a paragraph in index.html like below, and run gulp production:

{% block content %}
   ... ...
  <h4>RMA Procedures</h4>

  Sales invoices and packing lists in order for us to obtain the detailed information of the relevant goods from our quality control database.

{% endblock %}
@greypants
Copy link
Contributor

Hmm... Maybe related to #249

Feel like ttf2woff2 has been problematic. Try removing woff2 from the iconFont config extensions list, upgrading gulp-iconfont, or removing the iconfont config all together. I've been using SVG sprites instead for a while now.

@greypants
Copy link
Contributor

Weird that it's throwing an error in Nunjucks though.

@huguangju
Copy link
Author

No matter upgraded gulp-iconfont, removing woff2 from config extensions list or removed all iconfont config, it's also reported error.

After upgraded gulp-iconfont to 6.0.0, it reproted:

Error in plugin 'svgicons2svgfont'
Message:
    The "appendUnicode" option were renamed "prependUnicode". See https://github.com/nfroidure/gulp-svgicons2svgfont/issues/33

@huguangju
Copy link
Author

Maybe it is cause by Unicode Character 'LINE SEPARATOR' (U+2028), Javascript parse error on '\u2028' unicode character , can saw it in git diff:
qq20160225-0
mozilla/nunjucks#126

@greypants
Copy link
Contributor

I think this may be fixed by #256

@huguangju Can you pull the latest from master and confirm?

greypants pushed a commit that referenced this issue Mar 22, 2016
Resolves #249, addresses #248
@greypants
Copy link
Contributor

Also fixed the upgrade issue you mentioned with #258

Closing this, but please re-open if you're still having issues.

@huguangju
Copy link
Author

After removed Unicode Line Separator in Bash u2028, this end up worked

# http://stackoverflow.com/a/16552635/4723163
sed -i.old $'s/\xE2\x80\xA8/ /g' inFile

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants