问题
I'm trying to generate a new app using the following:
root@li184-76:/var/www/touch-2.3.1# sencha generate app NewApp ../newapp
However, I get the following:
Sencha Cmd v4.0.1.4
[INF] Workspace does not have framework touch at /var/www ... copying
[ERR] java.lang.NullPointerException
at com.sencha.util.Version.<init>(Version.java:36)
at com.sencha.command.generator.GeneratorCommands$WorkspaceCommand.getParameters(GeneratorCommands.java:130)
at com.sencha.command.BasePluginCommands$BasePluginCommand.doExecute(BasePluginCommands.java:23)
at com.sencha.command.generator.GeneratorCommands$WorkspaceCommand.execute(GeneratorCommands.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:175)
at com.sencha.cli.Command.dispatch(Command.java:42)
at com.sencha.cli.Commands.dispatch(Commands.java:64)
at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:124)
at com.sencha.command.generator.GeneratorCommands$AppCommand.generateWorkspace(GeneratorCommands.java:397)
at com.sencha.command.generator.GeneratorCommands$AppCommand.execute(GeneratorCommands.java:240)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:175)
at com.sencha.cli.Command.dispatch(Command.java:42)
at com.sencha.cli.Commands.dispatch(Commands.java:64)
at com.sencha.cli.Commands.dispatch(Commands.java:64)
at com.sencha.command.Sencha.dispatch(Sencha.java:80)
at com.sencha.command.Sencha.main(Sencha.java:148)
The confusing thing is I already have previously generated apps. I don't know why my attempts to create new ones are failing.
NOTE:
I tried upgrading Sencha but it does seems to have the desire effect as the following shows:
root@li184-76:/var/www/touch-2.3.1# sencha upgrade
Sencha Cmd v4.0.1.45
[INF] Determining the latest version of Sencha Cmd
[INF] The latest version of Sencha Cmd is 4.0.2.67
[INF] Sencha Cmd 4.0.2.67 is already installed
UPDATE:
I attempted to generate the app from outside the TOUCH folder but I get a weird error about SampleApp already existing. I have nothing called SampleApp in the target directory. The data is as follows:
root@li184-76:/var/www# sencha -sdk /var/www/touch-2.3.1/ generate app MyApp /var/www/myapp
Sencha Cmd v4.0.1.45
[ERR] Path /var/www/myapp is already a configured application named : SampleApp
[ERR] Path /var/www/myapp is already configured for application SampleApp
root@li184-76:/var/www#
回答1:
With thanks to arthurakay and Anand Gupta for your input and attempts to help, I eventually figured out the problem.
What had happened was at some point I corrupted my /var/www directory by attempting to generate a sencha app in the same, i:e /var/www, directory. That was the mistake that was causing all the havoc.
Luckily, I happened to list all the hidden files and found a .sencha folder which is why it kept complaining about SampleApp as described in the update section of my question.
Once I removed the .sencha folder and other related data, things moved beyond this to other challenges.
Thanks again for all your input.
回答2:
The stack trace you posted doesn't seem to have much info... but I notice that your command
sencha generate app NewApp ../newapp
doesn't include the -sdk flag. If you run your command from inside a Sencha Touch folder then you wouldn't need the -sdk flag... but if you're anywhere else on the filesystem you need to tell Sencha Cmd which SDK to use.
回答3:
I dont see any reason for the problem. You can give a try this, Instead running the command from from within the sdk folder, run it from outside using this command: sencha -sdk /path/to/sencha-touch-sdk generate app MyApp /path/to/www/myapp
来源:https://stackoverflow.com/questions/21371189/generating-sencha-touch-2-app-nullpointer-error