Problem minifying ENYO projects (node.exe not loading)

by Community Manager on ‎09-06-2013 07:59 AM

Question

When building Enyo MiniApps  these didn't seem to load when testing on an actual smartphone. Further investigating this issue, I found that using the simulator in 'appdev=false' mode, the same problem was being experienced, the simulator would be stuck in the loading screen.

 

I realised that the problem was with the minifying process, as debugging with Chrome revealed the following:

 

 

Hence 'minified' version of the MiniApp wasn't being deployed correctly.

 

After searching the forums I was unable to find a solution, but luckily checking the server log closely I was able to find the solution. This was the output of the minifying process:

 

     [exec] -------------------------------------------------------
     [exec]  HPA - Minify Process
     [exec] -------------------------------------------------------
     [exec] [INFO]
     [exec] [INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ HelloWorld ---
     [exec] 'node.exe' is not recognized as an internal or external command,
     [exec] operable program or batch file.

 

Answer

The problem lay within the automatically generated 'minify.bat' files. The enyo minify.bat had an incorrect path to 'node.exe' and hence the message displayed in the HPAnywhere console. This meant that the app wasn't being minified, which in turn produced the error described above.

 

To fix this, it is necessary to open the 'minify.bat' file under "[Enyo_Project]\src\webapp\enyo\tools" where [Enyo_Project] is the path of your project.

 

This 'minify.bat' contains the following code:

 

    REM don't watch the sausage being made
    @ECHO OFF

    REM the folder this script is in (*/enyo/tools)
    SET TOOLS=%~DP0

    REM enyo location
    SET ENYO=%TOOLS%\..

    REM minify script location
    SET MINIFY=%TOOLS%\minifier\minify.js

    REM node location
    SET NODE=node.exe

    REM use node to invoke minify with a known path to enyo and imported parameters
    %NODE% "%MINIFY%" -enyo "%ENYO%" %*

 

Highlighted in red is the part were 'node.exe' is referenced and where my problem lied. 'node.exe' is not set as an Environment Variable when installing HPAnywhere and hence you cannot call node directly in command line. However this node.exe is inside a folder ("C:\hp\HPAnywhere" by default) which has a PATH assigned [%BTOA_HOME%]. Thus to fix this problem, simply replace the highlighted line with the following:

 

SET NODE=%BTOA_HOME%\node.exe

 

Now my MiniApp correctly minifies and I am able to run it on a mobile device. Unfortunately, I believe this correction will need to be made to every future Enyo project.

Search
Showing results for 
Search instead for 
Do you mean 
Contributors
HP Blog

HP Software Solutions Blog

Featured


Follow Us
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.