Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I build this project myself #1112

Open
weifu6 opened this issue Jun 28, 2024 · 4 comments
Open

How do I build this project myself #1112

weifu6 opened this issue Jun 28, 2024 · 4 comments

Comments

@weifu6
Copy link

weifu6 commented Jun 28, 2024

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
Copy link
Member

dpvc commented Jun 28, 2024

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
Copy link
Author

weifu6 commented Jul 1, 2024

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;

...

@dpvc
Copy link
Member

dpvc commented Jul 1, 2024

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.json file:

    • remove the | grep --line-buffered 'Building\\|Webpacking\\|Copying\\|npx' from line 42.
  • In the components\bin\build file:

    • On line 81, change the \/ to \\ in the dir.replace() call.
    • On line 235, add .replace(/\\/g, '/') after the GLOBAL to get ${GLOBAL.replace(/\\/g, '/')}.
    • On line 236, add .replace(/\\/g, '/') after the VERSION to get ${VERSION.replace(/\\/g, '/')}.
    • On line 295, add .replace(/\\/g, '/') just before the final semicolon.
  • In the components\bin\makeAll file:

    • On lines 55, 56, and 57, change the first and last single quite (') to double quotes (") in all three lines.
  • In the components\bin\pack file:

    • On line 61, add , {shell: true} before the final );, making it
          const child = spawn('npx', ['webpack', '--json'], {shell: true});
  • In the components\src\output\chtml\webpack.config.json file:

    • Add the lineconst 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');
  • 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.

@weifu6
Copy link
Author

weifu6 commented Jul 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants