Build errors

11 views
Skip to first unread message

Scott Bloom

unread,
Oct 1, 2025, 4:41:27 PMOct 1
to MathJax Users
Following the build documentation at https://docs.mathjax.org/en/latest/web/hosting.html#obtain-mathjax

Im getting the following error when running pnpm build (or any of the build scripts)

$ pnpm build

> @mathjax/s...@4.0.0 build C:\Users\scott.TOWEL42\Dropbox\home\mathjax
> pnpm -s build-mjs

'log' is not recognized as an internal or external command,
operable program or batch file.

Ive installed the package log via npm install -g log, but that doesnt help.

Any help will be most appreciated.

Thanks
Scott

Davide Cervone

unread,
Oct 3, 2025, 9:53:05 AMOct 3
to mathja...@googlegroups.com
Scott:

Neither of the developers use Windows, so we don't do much testing of the build process there.  The error you are getting is because the MathJax package scripts expect to run in the bash shell, not the Windows command shell.  You can tell pnpm to use bash via the command:

npm config set script-shell "C:\\Program Files\\Git\\bin\\bash.exe"

provided you have git installed (which I presume you do, if you are building MathJax from source).

Note, however, that there will still be problems, as the build scripts have other problems with Windows.  As usual, the fact that Windows uses backslashes for directory separators, while everyone else uses forward slashes is one of the sources of issues, but also executing system commands requires special handling in node on Windows.

I spent some time working out the details, and provide the attached patch file that you should be able to apply to your cloned MathJax repository.  It should make the build tools work for you in the Windows shell (provided the file makes it through Google's filtering to this forum post; if not, I'll make a new post with the test of the patch).

Alternatively, you could use Windows Subsystem for Linux (WSL), or Cygwin or something similar, which should let you use the build process as is.

Also, I'm not sure why you need to rebuild MathJax, as the @mathjax/src node package already includes the compiled and bundled versions, and if you want to make change to MathJax, it is probably better to subclass the needed parts and use this subclasses rather than editing the MathJax source directly.

In any case, here's the patch.

Davide

windows.patch

Scott Bloom

unread,
Oct 3, 2025, 11:51:06 PMOct 3
to mathja...@googlegroups.com

Thanks!

I was (and typically always do) run this under bash.

I wonder if the issue is which node. Js it's picking up.

I installed the windows version, maybe it needs the cygwin version?

Thanks for the patch I'll get back you with an update

Scott


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/9F2FDECB-D9AD-44DB-9B13-3FC1EC7ADFB0%40gmail.com.


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/4981cfe9-9383-4981-8b79-fac46e492390n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/9F2FDECB-D9AD-44DB-9B13-3FC1EC7ADFB0%40gmail.com.

Davide Cervone

unread,
Oct 4, 2025, 7:25:05 AMOct 4
to mathja...@googlegroups.com

I was (and typically always do) run this under bash.


The shell you are running from has no bearing on the shell used by npm or pnpm, if I understand the documentation properly.  It looks like windows always uses cmd.exe unless you set the shell as in the npm config set script-shell command I gave.

I installed the windows version, maybe it needs the cygwin version?


I would guess the cygwin version would use the unix default shell, and I don't think that would work outside of cygwin (or Windows Subsystem for Linux, or another unix implementation).

Thanks for the patch I'll get back you with an update

Do let us know if that worked.

Davide

Scott Bloom

unread,
Oct 16, 2025, 2:05:57 PM (11 days ago) Oct 16
to mathja...@googlegroups.com
Sorry it took so long to get back to you.

Still failing with the same log message
1) I am now running the git bash directly, not cygwin, no difference
2) I have set the npm config setting to said bash
3) I have applied the patch

$ git st
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: components/bin/build
modified: components/bin/makeAll
modified: components/bin/pack
modified: package.json
modified: pnpm-lock.yaml

$ pnpm -s build-all
'log' is not recognized as an internal or external command,
operable program or batch file.

Thanks
Scott
> To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/933752C3-2C2D-453F-85C6-030F3F33D510%40gmail.com.

Davide Cervone

unread,
Oct 16, 2025, 2:11:38 PM (11 days ago) Oct 16
to mathja...@googlegroups.com
The message suggests that the bash setting isn't correct. Can you check to see if that bash executable is actually in the location in the command I gave you? If not, try using the path to the bash that you are using.

Also, try using

npm config list

and see if the script-shell setting is actually in place.

Davide
> To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/CAP3JwBtbdAJshU1Vff%2B%3DjSwy%2BmcWPEmU8jKVqqXi9UoJzQn9mw%40mail.gmail.com.

Scott Bloom

unread,
Oct 16, 2025, 3:30:35 PM (11 days ago) Oct 16
to mathja...@googlegroups.com
FINALLY got past the log issue. Thanks for all the help.

Here is what it took.
1) Don't use cygwin, use the git bash shell itself.
Once it worked, I didnt bother to try cygwing bash
2) rather than explicitly setting the path for bash as you suggested,
I ran this command
npm config set script-shell "$(cygpath -w $(which bash))"

I dont know if it was the double escape slashes in yours, or that you
pointed to bin/bash not usr/bin/bash, which are two different
executables in the git distro not a link as it is in cygwin. But that
did the trick.

Now for the next error :) I got a bunch of "could not find module"
turns out, I need the patch for this. once applied, I have now
successfully built

pnpm -s build-all

Again, thanks for all the help...
> To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/292A471A-59F0-454D-B934-40BB4C5E7021%40gmail.com.

Scott Bloom

unread,
Oct 16, 2025, 3:34:30 PM (11 days ago) Oct 16
to mathja...@googlegroups.com
Just an update, under cygin, the above command to set the
script-shell does work, but shows other problems
$ pnpm -s build-all
=============
Building mjs
=============
Building mjs sources
--Setting symbolic link
--Cleaning mjs directory
'rimraf' is not recognized as an internal or external command,
operable program or batch file.


Scott Bloom

unread,
Oct 16, 2025, 3:37:12 PM (11 days ago) Oct 16
to mathja...@googlegroups.com
Ignore that update, I forgot to run pnpm install.

I am now able to build under cygwin

Davide Cervone

unread,
Oct 16, 2025, 4:33:27 PM (11 days ago) Oct 16
to mathja...@googlegroups.com
I'm glad you got it to work. My command was set up to run in the Windows command shell, which has different escaping needs than bash, so maybe when you run it in bash, it didn't do the right thing. But you have it now, so that is great. Thanks for the updates, and for confirming that the changes allowed it to work for you.

Davide
> To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/CAP3JwBvHsmE3UPX-SesGGZmnDA%2B0OeZiGSpTYUjyQ84uppAc9w%40mail.gmail.com.

Scott Bloom

unread,
Oct 16, 2025, 5:10:36 PM (11 days ago) Oct 16
to mathja...@googlegroups.com

Now to get the actual project working ;)

Essentially making a modern version of qtmathjax (using qt6, not qt4)

I have it working fine via chromium, but the overhead of chromium is huge. They do have a jS node interface that I'm looking to use. The main thing is the application has to be able to work offline so I can't just point to a server somewhere to download the nodejs module.

If anyone is interested take a look at http://github.com/towel42-com/T42-MathJaxQt6

Its a fork off the old version.

Scott


Reply all
Reply to author
Forward
0 new messages