Phabricator is looking jsxmin which doesn't exist


#1

It seems phabricator has broken for us at some point. We have it installed on Centos 7.4.1708 using php 7.1.16 and apache 2.4.33. Phabricator is trying to execute a command jsxmin which I can’t seem to find any information on the internet about what it is and how to install it. Can you help find out where jsxmin should be installed from, or if there is a way to configure Phabricator not to use it?

Observed Behavior:

Phabricator dropdown menus have stopped working everywhere. The console in Google shows the following errors:

src.percentile.co.uk/:1 GET https://src.percentile.co.uk/res/defaultX/phabricator/638a4e2b/rsrc/externals/javelin/core/init.js 500 ()
src.percentile.co.uk/:1 Refused to execute script from ‘https://src.percentile.co.uk/res/defaultX/phabricator/638a4e2b/rsrc/externals/javelin/core/init.js’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.
src.percentile.co.uk/:1 GET https://src.percentile.co.uk/res/defaultX/phabricator/e452721e/core.pkg.js 500 ()
src.percentile.co.uk/:1 Refused to execute script from ‘https://src.percentile.co.uk/res/defaultX/phabricator/e452721e/core.pkg.js’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.

If I try and get those resources directly using Chrome I get an html page:

Command failed with error #1!
COMMAND
which ‘jsxmin’

STDOUT
(empty)

STDERR
which: no jsxmin in (/zfs-apps/apps/phabricator/support/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/usr/bin:/usr/local/bin)

On the server we have this exception:
[Wed May 09 17:24:11.537846 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] [2018-05-09 17:24:11] EXCEPTION: (CommandException) Command failed with error #1!\nCOMMAND\nwhich ‘jsxmin’\n\nSTDOUT\n(empty)\n\nSTDERR\nwhich: no jsxmin in (/zfs-apps/apps/phabricator/support/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/usr/bin:/usr/local/bin)\n at [/src/future/exec/ExecFuture.php:369]
[Wed May 09 17:24:11.538796 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] arcanist(head=master, ref.master=ad3087e5e151), phabricator(head=master, ref.master=16af0d35e510), phutil(head=master, ref.master=20eff1c8d14f)
[Wed May 09 17:24:11.538812 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #0 <#2> ExecFuture::resolvex() called at [/src/future/exec/execx.php:17]
[Wed May 09 17:24:11.538818 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #1 <#2> execx(string, string) called at [/src/filesystem/Filesystem.php:989]
[Wed May 09 17:24:11.538822 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #2 <#2> Filesystem::resolveBinary(string) called at [/src/filesystem/Filesystem.php:962]
[Wed May 09 17:24:11.538826 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #3 <#2> Filesystem::binaryExists(string) called at [/src/applications/celerity/CelerityResourceTransformer.php:94]
[Wed May 09 17:24:11.538844 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #4 <#2> CelerityResourceTransformer::transformResource(string, string) called at [/src/applications/celerity/controller/CelerityResourceController.php:98]
[Wed May 09 17:24:11.538850 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #5 <#2> CelerityResourceController::serveResource(array) called at [/src/applications/celerity/controller/CelerityPhabricatorResourceController.php:37]
[Wed May 09 17:24:11.538854 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #6 <#2> CelerityPhabricatorResourceController::handleRequest(AphrontRequest) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:258]
[Wed May 09 17:24:11.538858 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #7 phlog(CommandException) called at [/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
[Wed May 09 17:24:11.538862 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #8 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, CommandException) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:670]
[Wed May 09 17:24:11.538866 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #9 AphrontApplicationConfiguration::handleThrowable(CommandException) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:263]
[Wed May 09 17:24:11.538871 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:181]
[Wed May 09 17:24:11.538875 2018] [php7:notice] [pid 22321:tid 140415999645440] [client 192.168.1.15:49907] #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [/webroot/index.php:17]
[Wed May 09 17:24:11.811540 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] [2018-05-09 17:24:11] EXCEPTION: (CommandException) Command failed with error #1!\nCOMMAND\nwhich ‘jsxmin’\n\nSTDOUT\n(empty)\n\nSTDERR\nwhich: no jsxmin in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)\n at [/src/future/exec/ExecFuture.php:369]
[Wed May 09 17:24:11.812391 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] arcanist(head=master, ref.master=ad3087e5e151), phabricator(head=master, ref.master=16af0d35e510), phutil(head=master, ref.master=20eff1c8d14f)
[Wed May 09 17:24:11.812406 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #0 <#2> ExecFuture::resolvex() called at [/src/future/exec/execx.php:17]
[Wed May 09 17:24:11.812412 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #1 <#2> execx(string, string) called at [/src/filesystem/Filesystem.php:989]
[Wed May 09 17:24:11.812416 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #2 <#2> Filesystem::resolveBinary(string) called at [/src/filesystem/Filesystem.php:962]
[Wed May 09 17:24:11.812420 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #3 <#2> Filesystem::binaryExists(string) called at [/src/applications/celerity/CelerityResourceTransformer.php:94]
[Wed May 09 17:24:11.812425 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #4 <#2> CelerityResourceTransformer::transformResource(string, string) called at [/src/applications/celerity/controller/CelerityResourceController.php:98]
[Wed May 09 17:24:11.812429 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #5 <#2> CelerityResourceController::serveResource(array) called at [/src/applications/celerity/controller/CelerityPhabricatorResourceController.php:37]
[Wed May 09 17:24:11.812443 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #6 <#2> CelerityPhabricatorResourceController::handleRequest(AphrontRequest) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:258]
[Wed May 09 17:24:11.812448 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #7 phlog(CommandException) called at [/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
[Wed May 09 17:24:11.812452 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #8 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, CommandException) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:670]
[Wed May 09 17:24:11.812456 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #9 AphrontApplicationConfiguration::handleThrowable(CommandException) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:263]
[Wed May 09 17:24:11.812461 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:181]
[Wed May 09 17:24:11.812465 2018] [php7:notice] [pid 22321:tid 140416058394368] [client 192.168.1.15:49907] #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [/webroot/index.php:17]

Expected Behavior:
Drop down menus should work

Phabricator Version:
latest stable version

Reproduction Steps:
just try and open any phabricator page


#2

So I found this thing:

Compiled it and put it on the path. Now I get a different error in chrome:
behavior-locate-file.js:1 Uncaught ReferenceError: JX is not defined
at behavior-locate-file.js:1
(anonymous) @ behavior-locate-file.js:1
core.pkg.js:1 Uncaught ReferenceError: JX is not defined
at core.pkg.js:1
(anonymous) @ core.pkg.js:1
DiffusionLocateFileSource.js:1 Uncaught ReferenceError: JX is not defined
at DiffusionLocateFileSource.js:1


#3

I’ve traced the problem to:

line 55
window.__DEV__ = !!root.getAttribute('data-developer-mode');

__DEV__ gets replaced with 0 and so we get a javascript error because window.0 is invalid javascript.

How is this working for anyone is beyond me…


#4

Something is very odd in your system.

  1. The exception for jsxmin is not supposed to be thrown - this code checks for it’s existence. I don’t understand how you got that.
  2. node sure how __DEV__ gets replace with 0 - it should be assigned 0.
  3. “JX is not defined” means something doesn’t load correctly.

What kind of setup are you using (OS, webserver, php, proxies, CDN, etc)?


#5

I am using Centos 7.4.1708 using php 7.1.16 and apache 2.4.33


#6

The code that replaces __DEV__:
src/applications/celerity/CelerityResourceTransformer.php: $future = new ExecFuture('jsxmin __DEV__:0');


#7

Your code is corrupt - your Filesystem.php:989 includes execx call; Our code never had that call there - we use exec_manual - https://secure.phabricator.com/source/libphutil/browse/master/src/filesystem/Filesystem.php$974.

You should probably just reinstall the setup.


#8

Yep… I had edited that file to debug a different problem and forgot to revert my changes. Its back to working order now. Thanks.