MathJax-src
MathJax-src copied to clipboard
How do I build this project myself
I want to build this project on my computer, I installed all the dependencies, tried to run “npm run make-components”, but there is no way to build it correctly.
Did you
npm run compile
first?
If so, then what error message are you getting, or what is going wrong when you try to make the components? You don't give enough information to begin to diagnose you situation.
I had run "npm run compile" first,my step is:
npm install
npm run compile
npm run make-components
my error is:
D:\git\mathjax>npm run make-components
> [email protected] premake-components
> npm run --silent clean:es5 && npm run --silent clean:lib
> [email protected] make-components
> cd components && node bin/makeAll src
Building \src\a11y\assistive-mml
node:internal/modules/cjs/loader:1146
throw err;
^
Error: Cannot find module 'D:\git\mathjax\components\src\a11y\assistive-mml\'D:\git\mathjax\components\bin\build''
at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
at Module._load (node:internal/modules/cjs/loader:984:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.12.0
Command failed: node 'D:\git\mathjax\components\bin\build'
node:internal/modules/cjs/loader:1146
throw err;
^
Error: Cannot find module 'D:\git\mathjax\components\src\a11y\assistive-mml\'D:\git\mathjax\components\bin\build''
at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
at Module._load (node:internal/modules/cjs/loader:984:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.12.0
Building \src\a11y\complexity
node:internal/modules/cjs/loader:1146
throw err;
^
Error: Cannot find module 'D:\git\mathjax\components\src\a11y\complexity\'D:\git\mathjax\components\bin\build''
at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
at Module._load (node:internal/modules/cjs/loader:984:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.12.0
Command failed: node 'D:\git\mathjax\components\bin\build'
node:internal/modules/cjs/loader:1146
throw err;
...
I'm curious about why you are rebuilding the MathJax files; are you modifying the MathJax source code? If not, then mathjax-full comes with everything already compiled and the components made, so there is no need to do that yourself.
I see that you are running in a Windows shell. The build tools were designed for unix, and we haven't done any testing on Windows, so yeah, things go wrong there.
I've managed to get it to work on Windows by making the following changes:
-
In the
package.jsonfile:- remove the
| grep --line-buffered 'Building\\|Webpacking\\|Copying\\|npx'from line 42.
- remove the
-
In the
components\bin\buildfile:- On line 81, change the
\/to\\in thedir.replace()call. - On line 235, add
.replace(/\\/g, '/')after theGLOBALto get${GLOBAL.replace(/\\/g, '/')}. - On line 236, add
.replace(/\\/g, '/')after theVERSIONto get${VERSION.replace(/\\/g, '/')}. - On line 295, add
.replace(/\\/g, '/')just before the final semicolon.
- On line 81, change the
-
In the
components\bin\makeAllfile:- On lines 55, 56, and 57, change the first and last single quite (
') to double quotes (") in all three lines.
- On lines 55, 56, and 57, change the first and last single quite (
-
In the
components\bin\packfile:- On line 61, add
, {shell: true}before the final);, making itconst child = spawn('npx', ['webpack', '--json'], {shell: true});
- On line 61, add
-
In the
components\src\output\chtml\webpack.config.jsonfile:- Add the line
const path = require('path');at the top of the file. - Change line 16 (originally line 15 before the line added above to be
resource.request = path.join(__dirname, 'nofont.js');
- Add the line
-
Make the same changes to
components\src\output\svg\webpack.config.json.
That should allow you to perform the npm run -s make-components command, unless I have missed something that I changed. Let me know if you continue to have problems. There will be a lot of output without the grep command, but it should at least run.
Thank you very much for your patience. It works fine now.