1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    37
    Vote Rating
    0
    jksnu is on a distinguished road

      0  

    Default sencha create jsb is giving error

    sencha create jsb is giving error


    I am trying to compress my js files in my project based on ExtJs f4.1. I am following the simple steps like:
    1) I have installed SenchaSDKTools-2.0.0-beta3-windows.exe
    2) Downloaded JsBuilder2.0.
    3) opened my cmd and write the following command to create jsb3 file like
    C:\workspace\testing\WebContent>sencha create jsb -a http://127.0.0.1:8080/testApp/index.html -p appp.jsb3
    But, if I am running the above command, I am getting the following error:
    Phantomjs://webpage.evaluate():2
    Phantomjs://webpage.evaluate():1
    Reference Error: Can't find the variable: Ext
    Code for App.js is as follows:
    Code:
    Ext.Loader.setConfig({
     enabled : true,
     paths : {
      'Ext.ux.touch.grid':'Ext.ux.touch.grid',
      'Ux':'Ux',
      'Framework': 'js/mvc',
      'Ext' : 'sdk/src'
     }
    });
    </debug>
    
    Ext.application({
        name: 'Mobile',
        appFolder: 'js/com',
        requires: [
            'Ext.MessageBox'
        ],
                      
        views:  ['application.LogInPage'],
                 
        controllers: ['application.ApplicationController'],
                      
        models: ['component.Indicator'],
    
        stores: ['component.IndicatorInvestment'],
        icon: {
            57: 'resources/icons/Icon.png',
            72: 'resources/icons/Icon~ipad.png'
        },
        
        launch: function() {
            Ext.fly('appLoadingIndicator').destroy();
            // Initialize the main view
            Ext.Viewport.add(Ext.create(application.LogInPage'));
        },
        onUpdated: function() {
            Ext.Msg.confirm(
                "Application Update",
                "This application has just successfully been updated to the latest version. Reload now?",
                function() {
                    window.location.reload();
                }
            );
        }
    });

  2. #2
    Sencha Premium Member danguba's Avatar
    Join Date
    Feb 2009
    Location
    Kragujevac, Serbia
    Posts
    377
    Vote Rating
    27
    danguba will become famous soon enough danguba will become famous soon enough

      0  

    Default


    Try using hard drive path instead of web access
    All Best
    ---
    Željko Mitrović
    http://skitanja.blogspot.com/

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." Martin Golding

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    37
    Vote Rating
    0
    jksnu is on a distinguished road

      0  

    Default


    Hi danguba,

    I have tried using hard drive path but with no luck. I have used hard drive path in two ways:
    1)
    C:\workspace\testing\WebContent>sencha create jsb -a C:\workspace\testing\WebContent -p appp.jsb3
    Result: Command runs without any error but but appp.jsb3 is not created at WebContent folder.

    2)
    C:\workspace\testing\WebContent>sencha create jsb -a C:\workspace\testing\WebContent\index.html -p appp.jsb3
    Result: Command runs and appp.jsb3 file is created at WebContent folder but with blank files array. i.e. this file is of no use. Following is the generated appp.jsb3 file
    Code:
    {
        "projectName": "Project Name",
        "licenseText": "Copyright(c) 2012 Company Name",
        "builds": [
            {
                "name": "All Classes",
                "target": "all-classes.js",
                "options": {
                    "debug": true
                },
                "files": []
            },
            {
                "name": "Application - Production",
                "target": "app-all.js",
                "compress": true,
                "files": [
                    {
                        "path": "",
                        "name": "all-classes.js"
                    },
                    {
                        "path": "",
                        "name": "app.js"
                    }
                ]
            }
        ],
        "resources": []

  4. #4
    Sencha Premium Member danguba's Avatar
    Join Date
    Feb 2009
    Location
    Kragujevac, Serbia
    Posts
    377
    Vote Rating
    27
    danguba will become famous soon enough danguba will become famous soon enough

      0  

    Default


    How about
    C:\workspace\testing\WebContent>create jsb -a index.html -p test.jsb3 -v

    and could you post your index.html file
    All Best
    ---
    Željko Mitrović
    http://skitanja.blogspot.com/

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." Martin Golding

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    37
    Vote Rating
    0
    jksnu is on a distinguished road

      0  

    Default


    I have tried your suggestion but the result is same as in
    C:\workspace\testing\WebContent>sencha create jsb -a C:\workspace\testing\WebContent\index.html -p appp.jsb3


  6. #6
    Sencha User
    Join Date
    Apr 2012
    Posts
    37
    Vote Rating
    0
    jksnu is on a distinguished road

      0  

    Default


    Hi danguba,

    Its working. there was some error in app.js. and the corresponding .jsb3 file is being created by using both
    C:\workspace\testing\WebContent>create jsb -a index.html -p test.jsb3 -v
    or
    C:\workspace\testing\WebContent>sencha create jsb -a C:\workspace\testing\WebContent\index.html -p appp.jsb3

    Thanks a lot for your quick support.

  7. #7
    Sencha Premium Member danguba's Avatar
    Join Date
    Feb 2009
    Location
    Kragujevac, Serbia
    Posts
    377
    Vote Rating
    27
    danguba will become famous soon enough danguba will become famous soon enough

      0  

    Default


    Great! I'm glad you fixed it.
    All Best
    ---
    Željko Mitrović
    http://skitanja.blogspot.com/

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." Martin Golding

  8. #8
    Sencha User
    Join Date
    Apr 2012
    Posts
    37
    Vote Rating
    0
    jksnu is on a distinguished road

      0  

    Default


    Sorry, again disturbing you. I have one more confusion. My app-all.js is created successfully by using the command like "sencha build -p ......" but in this file, there is not any code of app.js file and therefore app-all.js file does not has lauch() function of app.js and due to this my login page is not being loaded. So, here, should we have to manually copy code from app.js to app-all.js or I am doing some mistake.

  9. #9
    Ext JS Premium Member
    Join Date
    Jul 2010
    Location
    UK
    Posts
    524
    Vote Rating
    29
    MrSparks has a spectacular aura about MrSparks has a spectacular aura about

      0  

    Default


    Give this process a try.

    Microsoft Windows Custom EXTJS build guide

    Important notes.

    Your web application must be running under a web server. i.e. IIS, Apache, Tomcat etc

    The biggest issues I found were file path related, therefore I’ve simplified the install path location of the SDK away from the Sencha default.

    1. Ensure that the "Sencha SDK Tools" are installed into the root of your development website.

    i.e. your web root should look something like this.

    Relative example
    \
    \extjs\
    \css\
    \images\
    \sdk\

    Logical example
    c:\mywebsites\root\
    c:\mywebsites\root\extjs\
    c:\mywebsites\root\css\
    c:\mywebsites\root\images\
    c:\mywebsites\root\sdk\

    URL Example
    http://localhost/root/
    http://localhost/root/extjs
    http://localhost/root/css
    http://localhost/root/images
    http://localhost/root/sdk

    #####################################

    Ok so, let’s get on with producing a custom EXTJS build

    Using the Sencha Example "Themes" for illustration purposes...

    http://localhost/ext/examples/themes/index.html



    Steps to follow

    1. Edit "index.html" and replace the framework call from "ext-all.js" to "ext.js"

    2. Open a command prompt and change directory to c:\mywebsites\root\sdk\

    3. Type and run the following

    sencha create jsb -a http://localhost/ext/examples/themes/index.html -p sencha_themes.jsb3

    4. You should now see a file called "sencha_themes.jsb3" inside the SDK directory

    5. Copy/move "sencha_themes.jsb3" to c:\mywebsites\root\extjs\examples\themes\

    6. Now the bit that that caught me out for a while... the next command must be ran from the same directory as where the themes index.html is located

    i.e. c:\mywebsites\root\extjs\examples\themes\


    Again from the command prompt change to the directory where index.html is located, then type and run the following (note the full stop at the end is required!)

    sencha build -p sencha_themes.jsb3 -d .

    7. You should see some output to the command prompt window... Such as....

    Loading the Project Name Project
    Loaded 0 Packages
    Loaded 2 Builds
    * Parse all-classes.js with options:
    - debug: true
    - debugLevel: 1
    * Parse app-all.js with options:
    - debug: false
    - debugLevel: 1
    * Compress and obfuscate app-all.js...
    Copy resources...
    Done building!

    8. You should now see a file called "app-all.js" inside the themes directory. This file is your custom build of the extjs framework.

    9. Edit "index.html" and replace the framework call from "ext.js" to "app-all.js"

    10. That's it; you should now have a custom build that only contains the components you need.


    Best

    MrSparks

  10. #10
    Sencha Premium Member danguba's Avatar
    Join Date
    Feb 2009
    Location
    Kragujevac, Serbia
    Posts
    377
    Vote Rating
    27
    danguba will become famous soon enough danguba will become famous soon enough

      0  

    Default


    Quote Originally Posted by jksnu View Post
    Sorry, again disturbing you. I have one more confusion. My app-all.js is created successfully by using the command like "sencha build -p ......" but in this file, there is not any code of app.js file and therefore app-all.js file does not has lauch() function of app.js and due to this my login page is not being loaded.
    I'm not sure mate. Everything worked fine for me once I switched to hard drive path. You could try to create same simple project like only popup Ext.Msg on app launch. If that doesn't work you could send that simple project to me so I can try to debug...

    Quote Originally Posted by jksnu View Post
    So, here, should we have to manually copy code from app.js to app-all.js or I am doing some mistake.
    Nope. SDK should do all that for you
    All Best
    ---
    Željko Mitrović
    http://skitanja.blogspot.com/

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." Martin Golding

Thread Participants: 2