slushjs / slush

The streaming scaffolding system - Gulp as a replacement for Yeoman
http://slushjs.github.io/generators
MIT License
1.24k stars 58 forks source link

SyntaxError: Unexpected token ILLEGAL at Function (native) #40

Closed rdomingue closed 9 years ago

rdomingue commented 9 years ago

I used Slush to generate a lot of projects without any problems. But now for one project I have this error:

"events.js:85
      throw er; // Unhandled 'error' event
            ^
SyntaxError: Unexpected token ILLEGAL
    at Function (native)
    at template (C:\Users\rene.domingue\AppData\Roaming\npm\node_modules\slush-c
ri\node_modules\gulp-template\node_modules\lodash\dist\lodash.js:6306:22)
    at DestroyableTransform._transform (C:\Users\rene.domingue\AppData\Roaming\n
pm\node_modules\slush-cri\node_modules\gulp-template\index.js:24:31)
    at DestroyableTransform.Transform._read (C:\Users\rene.domingue\AppData\Roam
ing\npm\node_modules\slush-cri\node_modules\gulp-template\node_modules\through2\
node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (C:\Users\rene.domingue\AppData\Roa
ming\npm\node_modules\slush-cri\node_modules\gulp-template\node_modules\through2
\node_modules\readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (C:\Users\rene.domingue\AppData\Roaming\npm\node_modules\slush-cr
i\node_modules\gulp-template\node_modules\through2\node_modules\readable-stream\
lib\_stream_writable.js:237:10)
    at writeOrBuffer (C:\Users\rene.domingue\AppData\Roaming\npm\node_modules\sl
ush-cri\node_modules\gulp-template\node_modules\through2\node_modules\readable-s
tream\lib\_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (C:\Users\rene.domingue\AppData\Roami
ng\npm\node_modules\slush-cri\node_modules\gulp-template\node_modules\through2\n
ode_modules\readable-stream\lib\_stream_writable.js:194:11)
    at write (C:\Users\rene.domingue\AppData\Roaming\npm\node_modules\slush-cri\
node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\node_modules\reada
ble-stream\lib\_stream_readable.js:623:24)
    at flow (C:\Users\rene.domingue\AppData\Roaming\npm\node_modules\slush-cri\n
ode_modules\gulp\node_modules\vinyl-fs\node_modules\through2\node_modules\readab
le-stream\lib\_stream_readable.js:632:7)"

I don't know exactly why, but when removing some folders and files, the slush works again. I was unable to find exactly what is causing this error. Is it in one of the modules? Is it a file copy/pasted in the new folder from slush that cause the error. Is it a 'too long name' problem?

rdomingue commented 9 years ago

For now I found that it seems to be from code inside some files that throw the errors. The list is not complete but I changed things like

<% Application Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %>

To

< Application Inherits="Umbraco.Web.UmbracoApplication" Language="C#" >

And remove some things like ${major}

Somehow I can tell during the copying phase of slush to ignore caracters like theses ?

amitmtrn commented 9 years ago

I think it's more related to gulp-template than slush. as you can see the <% %> syntax is part of the https://lodash.com/docs#template. I think you should try something like

<%= '\\<% Application Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %\\>'%>
rdomingue commented 9 years ago

Exactly what I found after yeah. Well the problem is that I pull umbraco template so I cannot (and shouldn't) modify the files. I will need to pass a parameter to gulp-template to use something else than <% %>. I don't know if it's doable. The exemple I used here it's not really a big problem but I have other files that I must fill with variables that have bigger problems.

Thanks to point me a suggestion @amitmtrn I will try to find something on lodash.com but all this stuff is far from my field of knowledge. Thanks