Sencha Touch 2: Cannot find module `/sencha-sdk-dir/command/sencha.js`

淺唱寂寞╮ 提交于 2019-12-24 10:46:49

问题


I am on Arch Linux x64 with Sencha Touch 2 x64 installed. From the SDK directory, I ran ./sencha

[jiewmeng@JM SenchaSDKTools-2.0.0-beta3]$ ./sencha
[WARN] The current working directory (/opt/SenchaSDKTools-2.0.0-beta3) is not a recognized Sencha SDK or application folder. Running in backwards compatible mode.

Sencha Command v2.0.0 Beta 3
Copyright (c) 2012 Sencha Inc.

usage: sencha COMMAND [ARGS]

The available commands are:
   build            build a JSB project
   create bootstrapdata     generate boostrap data
   create jsb           generate a minimal JSB project for an app
   create locale            generate a template locale file from source
   create manifest      generate classes manifest
   package          package your Touch web app into a native bundle
   slice theme          slice a custom theme's images for IE

See 'sencha help COMMAND' for more information on a specific command.

I fixed that by adding a file .senchasdk with just "." init (as I figued Google-ing), but now I get

[jiewmeng@JM SenchaSDKTools-2.0.0-beta3]$ ./sencha

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Cannot find module '/opt/SenchaSDKTools-2.0.0-beta3/command/sencha.js'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

Whats wrong?


回答1:


I solve this problem just adding the SDK path as a System Variable, and the run the command inside the sencha library folder, not the SDK folder.




回答2:


I was getting the same warning as:

[jiewmeng@JM SenchaSDKTools-2.0.0-beta3]$ ./sencha
[WARN] The current working directory (/opt/SenchaSDKTools-2.0.0-beta3) is not a recognized Sencha SDK or application folder. Running in backwards compatible mode.

Sencha Command v2.0.0 Beta 3
Copyright (c) 2012 Sencha Inc.

usage: sencha COMMAND [ARGS]

The available commands are:
   build                    build a JSB project
   create bootstrapdata     generate boostrap data
   create jsb               generate a minimal JSB project for an app
   create locale            generate a template locale file from source
   create manifest          generate classes manifest
   package                  package your Touch web app into a native bundle
   slice theme              slice a custom theme's images for IE

See 'sencha help COMMAND' for more information on a specific command....

Then I downloaded the Sencha-Touch-2.0.1.1-gpl and extracted the contents to my web-root (i.e., /var/www/sencha-touch-2.0.1.1), and lastly downloaded the SenchaSDKTools and installed it via terminal as root user as follows:

root@user:/your/directory/where yo downloaded the sdk tool# ./SenchaSDKTool-2.0.1-beta3.run

I then waited for the installer to unzip the file and selected the installation directory as same where I put the Sencha-Touch library and the we have the following:

root@user:/var/www/sencha-touch-2.0.1.1# ./sencha
Sencha Command v2.0.2
Copyright (c) 2012 Sencha Inc.

.. and that is it people happy coding in sencha :-)




回答3:


@todotresde Could you please share a full recipe for how to configure this on a Mac OS X.

I've just downloaded and installed the Sencha SDK in the /Applications folder, but I would hate to populate that folder with Sencha applications as instructed in the SenchaDocs at http://docs.sencha.com/touch/2-0/#!/guide/command

cd /path/to/sencha-touch-2-sdk

sencha

The SDK install adds the SDK path variable to ~/.bash_profile

export PATH=/Applications/SenchaSDKTools-2.0.0-beta3:$PATH

export SENCHA_SDK_TOOLS_2_0_0_BETA3="/Applications/SenchaSDKTools-2.0.0-beta3"

I see some good pointers here:

http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap/

As per a standard Sencha application architecture, download the SDK and then place (or symlink) it within the lib directory, named touch. We will be putting our own code in the app directory

IMPORTANT: When you are developing or experimenting, it's fine to simply place the whole SDK inside the lib folder like this. But when deploying, make sure that only the required JavaScript and CSS files remain in that folder, and remove the rest of the SDK. You do not want to compile and distribute the entire Sencha Touch SDK with your app.




回答4:


First you add the SenchaSDK folder to you path,

export PATH=$PATH:/your/path/to/SenchaSDK

then you set the SENCHA_SDK_TOOLS_2_0_0_BETA3 environment variable,

export SENCHA_SDK_TOOLS_2_0_0_BETA3=/your/path/to/SenchaSDK

Now you go to your sencha library directory, like /your/path/to/sencha-touch-2.0.1.1, and you should be able to run the sencha command with no problem.



来源:https://stackoverflow.com/questions/10508857/sencha-touch-2-cannot-find-module-sencha-sdk-dir-command-sencha-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!