mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

Not Able to import mathlive in angular version 8.0 project

Open don-spaghetti opened this issue 5 years ago • 2 comments

Im getting errors in my terminal when i try to import mathlive in my angular project. When i try to import like this: import { MathfieldElement, Mathfield} from 'mathlive'; or import { MathfieldElement} from 'mathlive';

I get this error in my terminal: Untitled

My package.json:

{ "name": "modulus", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "build": "ng build --outputPath ../Modulus.Client.Web/dist", "build:prod": "ng build --outputPath ../Modulus.Client.Web/dist --prod", "build:container": "ng build --outputPath ./build --prod", "build:ci": "node --max_old_space_size=2048 node_modules/@angular/cli/bin/ng build --outputPath ../Modulus.Client.Web/dist --configuration=ci", "watch": "ng build --outputPath ../Modulus.Client.Web/dist --watch", "build-osx": "ng build --outputPath ../Modulus.Client.Web/dist", "build-osx:prod": "ng build --prod --build-optimizer --outputPath ../Modulus.Client.Web/dist", "watch-osx": "ng build --outputPath ../Modulus.Client.Web/dist --watch", "analyze": "ng build --stats-json && webpack-bundle-analyzer dist/stats.json", "test": "ng test --browsers Chrome_no_sandbox", "test-debug": "ng test --watch --browsers Chrome_with_debugging", "lint": "ng lint", "e2e": "ng e2e", "extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n/*.json --clean --sort --format namespaced-json", "postinstall": "patch-package && node ./src/assets/tinymce-formula/copy-tinymce-formula.ts", "compodoc": "npx compodoc -p src/tsconfig.json" }, "private": true, "typings": "./src/typings.d.ts", "dependencies": { "@angular/animations": "8.2.0", "@angular/cdk": "^7.3.7", "@angular/common": "8.2.0", "@angular/compiler": "8.2.0", "@angular/core": "8.2.0", "@angular/forms": "8.2.0", "@angular/material": "^7.3.7", "@angular/platform-browser": "8.2.0", "@angular/platform-browser-dynamic": "8.2.0", "@angular/router": "8.2.0", "@ctrl/ngx-codemirror": "^4.1.0", "@microsoft/signalr": "5.0.6", "@nc-stil/sds-lib": "^8.1.0-beta.50", "@ngx-translate/core": "^11.0.1", "@ngx-translate/http-loader": "^4.0.0", "@nicky-lenaers/ngx-scroll-to": "^2.0.0", "angular2-chartjs": "0.5.1", "angular2-hotkeys": "2.1.4", "angular2-multiselect-dropdown": "4.6.9", "bootstrap": "4.3.1", "buffer": "^6.0.3", "class-validator": "0.9.1", "codemirror": "^5.60.0", "core-js": "2.5.7", "dkfds-plugins": "^5.3.0", "flatpickr": "4.6.2", "focus-trap": "^6.6.1", "font-awesome": "4.7.0", "html2canvas": "1.0.0-alpha.10", "jquery": "3.5.1", "mathlive": "^0.69.7", "moment": "2.24.0", "ng2-dnd": "^5.0.2", "ng2-pdf-viewer": "^6.3.2", "ng2-select2": "1.0.0-beta.10", "ngx-bootstrap": "^5.3.2", "ngx-toastr": "^10.2.0", "platform": "1.3.5", "popper.js": "1.15.0", "rxjs": "6.5.2", "select2": "4.0.13", "tinymce": "4.9.11", "tinymce-formula": "^1.1.0", "tslib": "^1.11.0", "zone.js": "~0.10.0" }, "devDependencies": { "@angular-devkit/build-angular": "0.803.29", "@angular/cli": "8.2.0", "@angular/compiler-cli": "8.2.0", "@angular/language-service": "8.2.0", "@biesbjerg/ngx-translate-extract": "^4.2.0", "@types/jasmine": "2.8.8", "@types/jasminewd2": "2.0.3", "@types/node": "10.14.14", "@types/select2": "4.0.44", "@types/signalr": "^2.2.36", "codelyzer": "^5.2.1", "fs-extra": "^10.0.0", "handlebars": "^4.7.7", "jasmine-core": "2.8.0", "jasmine-spec-reporter": "4.2.1", "karma": "^4.4.1", "karma-chrome-launcher": "^3.1.0", "karma-cli": "^2.0.0", "karma-coverage-istanbul-reporter": "^2.0.5", "karma-jasmine": "^2.0.1", "karma-jasmine-html-reporter": "^1.4.2", "karma-junit-reporter": "^2.0.1", "node-sass": "^4.14.1", "patch-package": "6.1.2", "protractor": "5.1.2", "puppeteer": "^8.0.0", "ts-node": "8.3.0", "tslint": "5.18.0", "typescript": "^3.5.3", "webpack-bundle-analyzer": "3.4.1" } }

don-spaghetti avatar Oct 18 '21 11:10 don-spaghetti

It's because of the different version of Typescript used in the different projects. You can either upgrade your Angular (and Typescript) version or to add it to the project by adding a line like this to your index.html file - <script src="https://unpkg.com/[email protected]/dist/mathlive.min.js"></script>

evyatarbh avatar Nov 15 '21 11:11 evyatarbh

No activity in a while. Closing.

arnog avatar Apr 13 '22 04:04 arnog