x)- [x] bug report -> please search issues before submitting
- [ ] feature request
Output from: ng --version:
@angular/cli: 1.0.0
node: 7.2.1
os: win32 x64
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1
OS:
Windows 10.
I previously set yarn as my default package manager.
I started the project with
ng new math-bug
I installed dependencies
yarn add express body-parser mathjax mongoose
yarn add @types\mathjax --dev
I modified the file .angular-cli.json adding the following to the scripts array (previously empty).
"../node_modules/mathjax/MathJax.js"
I added a component to my project that uses the line:
"MathJax.Hub.Queue([ "Typeset", MathJax.Hub, this.id]);"
When I build my project I get the error:
ERROR in C:/Users/Pat/ProgrammingProjects/math-bug/src/app/latex/latex.component.ts (23,9): Cannot find name 'MathJax'.
C:/Users/Pat/ProgrammingProjects/math-bug/src/app/latex/latex.component.ts (23,40): Cannot find name 'MathJax'.
ERROR in C:/Users/Pat/ProgrammingProjects/math-bug/src/app/latex/latex.component.ts (23,9): Cannot find name 'MathJax'.
C:/Users/Pat/ProgrammingProjects/math-bug/src/app/latex/latex.component.ts (23,40): Cannot find name 'MathJax'.
I would like to be able to use MathJax on my project. I previously had an Angular 2 project that used systemjs where this was not a problem. I believe I followed all the instructions for global library installation as described here, but it's possible I'm misunderstanding something.
I built a repo that demonstrated what's happening. It can be seen here
i cloned your repo trying to get this running, i added this line to LatextComponent:
import * as MathJax from 'mathjax/MathJax';
the error doesn't show any more, but it shows another error, that it failed to fetch MathMenu and MathZoom, i will keep trying and let you know if anything came up.
it worth mentioning that i've tried:"
import { MathJax } from 'mathjax';
but this error showed up:
File 'math-bug/node_modules/@types/mathjax/index.d.ts' is not a module.'
Try adding "mathjax" to the types array in src/tsconfig.app.json. I had a similar error and that fixed it for me.
@isaacplmann Thanks! That fixed it for me.
Closing as answered by @isaacplmann, cheers!
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Try adding
"mathjax"to thetypesarray insrc/tsconfig.app.json. I had a similar error and that fixed it for me.