Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Sencha CMD build fail with PhantomJS error code 2?

Problem: "Error capturing theme" while building Sencha CMD workspace application for sub-project A (has source files), but sub-project B (no source files) builds fine.

Scenario:

  1. Created new Sencha workspace (CMD 5.1.0.26) and added a new project A.
  2. Project A builds fine (sencha app build -c production)
  3. I add a main view and reference a module contained in a common folder (/project/common/js/).

  4. sencha app watch works fine however sencha app build -c production now fails on Project A.

  5. To sanity check, I generate a new application inside my framework folder, referencing the same ExtJS version (5.1.0.107), let's call it project B, and it builds just fine.

Project A is still failing with this error:

[INF] Writing content to /MyWorkspace/ProjectA/sass/example/bootstrap.json
[INF] Writing content to /MyWorkspace/ProjectA/sass/example/bootstrap.js
[INF] Capturing theme image
[ERR] loading page /MyWorkspace/ProjectA/sass/example/theme.html
== Unhandled Error ==
TypeError: '''undefined''' is not a function (evaluating '''Ext.require([
    '''Ext.layout.Context'''
])''')

  file:///MyWorkspace/ext/packages/ext-theme-base/sass/example/render.js:7

[ERR]
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExProcess: phantomjs process exited with code 2
[ERR]
[ERR] Total time: 46 seconds
[ERR] The following error occurred while executing this line:
/MyWorkspace/ProjectA/.sencha/app/slice-impl.xml:306: The following error occurred while executing this line:
/MyWorkspace/ProjectA/.sencha/app/slice-impl.xml:307: The following error occurred while executing this line:
/MyWorkspace/ProjectA/.sencha/app/slice-impl.xml:163: com.sencha.exceptions.ExProcess: phantomjs process exited with code 2

Workaround: I've prevented the error for now by editing sencha.cfg and adding the line: skip.slice=1

However files in /MyWorkspace/ProjectA/sass/ are the same between the failing Project A and Project B with the exception that the content differs slightly in files that reference the application names, but that is all.

The ExtJS files are few enough that I've done a manual walk through of the differences, with the exception of bootstrap.json which didn't lend itself to anymore than a visual skim.

I'd be most interested if anyone has pointers as to what is likely missing or different between these projects that appears to be causing part of my framework to be missing when it's needed in evaluating line 7 of render.js.

Let me know if you need more supporting information. Thanks!

like image 284
Duncan Avatar asked Feb 01 '15 19:02

Duncan


1 Answers

While building extjs application we have got this error

com.sencha.exceptions.ExProcess: phantomjs process exited with code 1

Solution:

We downloaded the latest version of phantomjs from here and replaced the phantomjs.exe file with cmd

phantomjs.exe "cmd/bin.windows/phantomjs/phantomjs.exe"

It worked for us.

like image 85
Rashid Mumtaz Avatar answered Nov 17 '22 04:11

Rashid Mumtaz