View Full Version : Ext 4.2.1 Commercial - Ext.cmd missing in Ext.js file

30 May 2013, 6:58 AM
Hi all,

I recently upgraded my project to use ExtJS 4.2.1 commercial package. However, my page is broken after that. The error is:

Uncaught TypeError: Cannot call method 'derive' of undefined ext.js:18 (

(anonymous function)ext.js:18


My page includes Ext.js and my compiled app-all.js files. Looking inside the ext.js file, I see it calls function Ext.cmd.derive to define classes, but, the object Ext.cmd isn't defined before usages.

My project worked fine with prior ExtJS packages.

My questions: Am I doing it wrong in ExtJS 4.2.1? Should I use a different file than Ext.js? Should I include additional files? Or is this a bug in ExtJS 4.2.1?

30 May 2013, 8:58 AM
Did you run "sencha app upgrade /path/to/sdk" after installing Cmd 3.1.2 and ExtJS 4.2.1?

30 May 2013, 8:22 PM
This is a pretty significant change for a revision!

I'm having exactly the same issue as the op. My answer to your question is no - we don't use Sencha Cmd at all.

31 May 2013, 2:02 PM
cmd.derive() is injected by 3.1.2 into the compiled libs, but shouldn't be running anywhere else (ext-dev.js, non-cmd built compressed libs, etc.).

Can you expand on what steps you've taken leading up to seeing that error?

31 May 2013, 2:20 PM
Log in to support.sencha.com.
Download Ext 4.2.1 from May 22
Extract ext.js from zip
Examine contents

Notice that all uses of Ext.define appear to be replaced with Ext.cmd.derive, which itself is not defined.

The point is that you can't just drop ext.js into a web page and have it work in this version. Make a blank html page that references ext.js and you'll get a type error due to the missing "cmd" object.

4 Jun 2013, 2:51 PM
The ext.js file has been reported as a bug and is being worked on now. In the interim you can use ext-all.js in its place.

7 Jun 2013, 5:36 AM
not only in ext.js file, same issue in ext-core.js

12 Jun 2013, 4:48 AM
Meanwhile you can minify ext-debug.js using yui-compressor (which is also part of Sencha cmd and SDK Tools):

java -jar ~/SenchaTools/bin/yuicompressor.jar ext-debug.js -o ext.js

25 Jun 2013, 11:25 AM
Is this solved? the minified option didn't worked...

EDIT: Sorry, the minified option works.

11 Aug 2013, 11:21 PM
I downloaded sencha 5 days back and , i got the issue.
Slemmon, could you give a link where we can check the progress of the issue (jira link.. i am new to sencha, so i dont know if jira exists or not)

22 Aug 2013, 12:57 AM
:-?same question...

27 Sep 2013, 7:26 PM

The Bug ID is EXTJSIV-11395.

In the meantime the use of ext-debug.js is the accepted workaround.

5 Jun 2014, 7:52 AM
Well, I unwittingly paid for Ext JS 4 exactly two days before they released JS 5, so at the moment I'm stuck with an old version. And what I got was this error in ext.js.

Even if I minimize ext-debug.js, it still loads some 30 or so other js files, all of which appear to be debug versions, and none of them are minimized. But please, don't let any of this disturb any of you. Allow me go spend my time minimizing them all myself manually.

What is this? I paid for a solution, not a problem.

8 Jun 2014, 12:05 AM
If you're only a few days in, I highly recommend jumping on the v5 boat, or at least using the latest Sencha Cmd. With the way Sencha Cmd works now, all of Ext, referenced packages and your own app get bundled into the same file. In other words, using the "ext.js" file directly in production shouldn't be necessary any more. On the development side, v5 allows you to use the micro loader instead of "ext-dev.js".

11 Jul 2014, 7:40 PM
I just sent a request to "Contact Us" asking for a refund. I was sold a non-working product.

It's making 400-600 requests to my server for various js files. How can THAT be the "accepted workaround"?

Obviously they don't read their forum either or didn't care that people were complaining about this issue... too busy releasing extjs 5 I suppose.

Problem is, by the time I realized that this issue existed, I had already finished production on my code. I don't want to move to extjs 5 and have to redo all the modifications I made to the extjs 4 files, many of which I would have to reinvent all over again because I didn't exactly keep detailed logs of every change I made.

I really wish they would just send me a corrected ext.js file, without the bugs. But if not then I want a refund because they sold me a broken product.

16 Jul 2014, 4:18 PM

I am sorry to hear you are having difficulties with Ext JS 4.2.1 on this issue. It sounds like there may be some misunderstanding on the recommended workarounds in this thread.

To clarify, the only differences between "ext.js" and "ext-debug.js" are:

"ext-debug" is not compressed (or "minified").
"ext-debug" is not run through the Cmd optimizer.

These files otherwise contain exactly the same code, so switching to a fixed "ext.js" would not change the number of requests to your server. Further, both flavors download required classes from the "src" folder. In short, both of these files are intended to support debugging.

To reduce the downloads to as few files as possible we provide Sencha Cmd which will build your application and include only the framework code you are using into a single js file that is both compressed and optimized.

The next alternative to building your app with Sencha Cmd is to use "ext-all.js". That files has all the framework code and is both compressed and optimized. Your application code would be a separate issue but could be dynamically loaded or handled in whatever way you see fit.

So, back to the OP... To create a minified (but not optimized) ext.js from ext-debug.js you can use this command (using Sencha Cmd) in the Ext JS 4.2.1 SDK folder:

sencha fs minify -yui -from=ext-debug.js -to=ext.js

16 Jul 2014, 5:15 PM
Thanks for the replay, but, you seem to be saying something contrary to what the documentation says.

The documentation says that a combination of both ext.js and app-all.js are required for production release to work. That is what I'm currently using. Well, that's what I *would* be using if ext.js wasn't broken. Instead I'm using ext-debug.js along with app-all.js.

Here is the exact quote from the documentation:

Notice that ext-debug.js has been replaced with ext.js, and app.js has been replaced with app-all.js. If you navigate tohttp://localhost/helloext/index-prod.html (http://localhost/helloext/index-prod.html) in your browser, you should see the production version of the "Hello Ext" application.

That quote is found at the bottom of the page at: http://docs.sencha.com/extjs/4.2.1/#!/guide/getting_started

But you seem to be saying that there is a single file created by sencha cmd? Where? It makes app-all.js, however, according to the documentation that's supposed to still require ext.js, and I can't use ext.js so I use ext-debug.js, and it's far from production quality since it is downloading a zillion js files to load the page.

17 Jul 2014, 3:20 PM
@behealed -

Ah. Sadly the doc corrections for that guide was only posted for 4.2.2 and not 4.2.1. The SDK Tools referenced in the 4.2.1 docs were replaced by Sencha Cmd and the guides for that can be found at:


For Cmd topics like this one, the 4.2.2 doc set is the more current. These are more about Sencha Cmd than that particular patch level of Ext JS.

To try and understand more precisely what you are seeing I have a couple questions:

Instead I'm using ext-debug.js along with app-all.js.

What is contained in your app-all.js? Also, were you able to produce that using the SDK Tools or how did you get that file generated from your source?

But you seem to be saying that there is a single file created by sencha cmd? Where? It makes app-all.js, however, according to the documentation that's supposed to still require ext.js

Sencha Cmd will produce "app.js" by default in the "build" folder. It sounds like you are using SDK Tools though. Can you post the exact commands and console output you see so I can better follow?

I can't use ext.js so I use ext-debug.js, and it's far from production quality since it is downloading a zillion js files to load the page.

Both ext.js and ext-debug.js contain just the "core files" for the framework. The "ext-debug.js" file also contains the metadata about the other classes in the framework to enable the Loader to find them. With SDK Tools, the build would use the Loader history to build a file with the dynamically loaded parts of the framework and your app.

Since you are getting lots of load requests that sounds like the app-all.js file does not contain all of the files you need. If that is the case, ext.js would have the same problems as ext-debug.js.