How can I get more specific build error message



  • Hello,

    I am running nodebb 1.8.1 and developing few custom plugins. To build I generally use ./nodebb build from command line.

    When there is an error, I sometimes get the following message:

    D:\nb>nodebb build "javascript"
    started

    2018-04-04T20:29:53.546Z [155564] - info: [build] Building in parallel mode
    2018-04-04T20:29:53.548Z [155564] - info: [build] plugin static dirs  build started
    2018-04-04T20:29:53.553Z [155564] - info: [build]  requirejs modules  build started
    2018-04-04T20:29:53.554Z [155564] - info: [build]   client js bundle  build started
    2018-04-04T20:29:53.556Z [155564] - info: [build]    admin js bundle  build started
    2018-04-04T20:29:57.282Z [155564] - info: [build] plugin static dirs  build completed in 3.734sec
    2018-04-04T20:30:03.510Z [155564] - error: [build]   client js bundle  build failed
    2018-04-04T20:30:03.512Z [155564] - error: [build] Encountered error during build step SyntaxError: Unexpected token: punc (,)
    	at JS_Parse_Error.get (eval at <anonymous> (D:\nb\node_modules\uglify-js\tools\node.js:21:1), <anonymous>:75:23)
    	at D:\nb\src\meta\minifier.js:115:19
    	at D:\nb\src\meta\minifier.js:242:11
    	at D:\nb\node_modules\async\dist\async.js:1126:9
    	at D:\nb\node_modules\async\dist\async.js:473:16
    	at iterateeCallback (D:\nb\node_modules\async\dist\async.js:980:24)
    	at D:\nb\node_modules\async\dist\async.js:958:16
    	at D:\nb\node_modules\async\dist\async.js:1123:13
    	at D:\nb\src\meta\minifier.js:212:4
    	at D:\nb\node_modules\graceful-fs\graceful-fs.js:78:16
    2018-04-04T20:30:03.513Z [155564] - error: SyntaxError: Unexpected token: punc (,)
    	at JS_Parse_Error.get (eval at <anonymous> (D:\nb\node_modules\uglify-js\tools\node.js:21:1), <anonymous>:75:23)
    	at D:\nb\src\meta\minifier.js:115:19
    	at D:\nb\src\meta\minifier.js:242:11
    	at D:\nb\node_modules\async\dist\async.js:1126:9
    	at D:\nb\node_modules\async\dist\async.js:473:16
    	at iterateeCallback (D:\nb\node_modules\async\dist\async.js:980:24)
    	at D:\nb\node_modules\async\dist\async.js:958:16
    	at D:\nb\node_modules\async\dist\async.js:1123:13
    	at D:\nb\src\meta\minifier.js:212:4
    	at D:\nb\node_modules\graceful-fs\graceful-fs.js:78:16
    

    This message is very generic and does not give me any clue were to look. I often resolve this issue by exhaustive search over my new code, specially looking at style and template files to find the error. I am however refactoring large part of my code and looking at diffs is becoming very time consuming if not impossible.

    Is there an easy way to make uglify.js more verbose so it can tell me which file is breaking the build?

    Any hint would be appreciated.

    Thank you.


  • Global Moderator

    I'm making some changes to better represent minify errors. In the meantime, I suggest you use a JS linter plugin in your editor to provide realtime feedback for syntax errors.



  • @pitaj said in How can I get more specific build error message:

    JS linter plugin

    @PitaJ Thank you,

    1. Can you recommend a Linter for Atom?
    2. Restarting nodebb from ACP is supposed to build it so why is it different than command line build? I made some changes and restarting did not pick up the changes but didn't report error either. Command line however bombed out so I know there was an issue. Is there a log somewhere for either of these methods? My ~/nodebb/logs/output.log file is empty.

    Thanks gain.



  • i am also getting the same issue


  • Global Moderator

    Just FYI, you can use ./nodebb build --dev to skip minification entirely, which would result in getting runtime symtax errors instead.



  • @pitaj that was great tip... When I bypass minification as you described (nodebb build --dev) it builds successfully, but it bombs out when I use 'nodebb build'. By the way I spend the whole day to run eslint to fix all of the reported issues but didn't help with build issue. Again thanks for the tip.



  • It was rather trivial to add the error message, here is how:

    in uglify-js module, added a error reporting log to the file lib\parse.js in following method:

    function js_error(message, filename, line, col, pos) {
        console.log(message, filename, line, col, pos);
        throw new JS_Parse_Error(message, filename, line, col, pos);
    };
    

    Looks like the error handling of fault barrier doesn't do what it supposed to.

    @PitaJ Thank again for your help.


Log in to reply
 

Suggested Topics

| |