mathjax / MathJax-src

MathJax source code for version 3 and beyond
https://www.mathjax.org/
Apache License 2.0
2k stars 200 forks source link

How do I build this project myself #1112

Open weifu6 opened 3 weeks ago

weifu6 commented 3 weeks ago

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.

dpvc commented 3 weeks ago

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.

weifu6 commented 2 weeks ago

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

> mathjax-full@3.2.2 premake-components
> npm run --silent clean:es5 && npm run --silent clean:lib

> mathjax-full@3.2.2 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;

...
dpvc commented 2 weeks ago

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:

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.

weifu6 commented 2 weeks ago

Thank you very much for your patience. It works fine now.