简体   繁体   中英

Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js):

I was trying to install Angular Material. Then, I got this error. I deleted the node modules and I wrote npm i again. However, it's not working. How can I fix it?

When I want to run app using ng serve , I got this error:

./node_modules/ngx-print/fesm2020/ngx-print.mjs - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js):
93     static ɵdir: i0.ɵɵDirectiveDeclaration<NgxPrintDirective, "button[ngxPrint]", never, { "previewOnly": "previewOnly"; "printSectionId": "printSectionId"; "printTitle": "printTitle"; "useExistingCss": "useExistingCss"; "printDelay": "printDelay"; "printStyle": "printStyle"; "styleSheetFile": "styleSheetFile"; }, {}, never, never, false, never>;

package.json:

{
  "name": "cuba",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.1.0",
    "@angular/animations": "~13.0.3",
    "@angular/cdk": "^11.0.1",
    "@angular/common": "~13.0.3",
    "@angular/compiler": "~13.0.3",
    "@angular/core": "~13.0.3",
    "@angular/fire": "^5.4.2",
    "@angular/forms": "~13.0.3",
    "@angular/localize": "~13.0.3",
    "@angular/platform-browser": "~13.0.3",
    "@angular/platform-browser-dynamic": "~13.0.3",
    "@angular/router": "~13.0.3",
    "@angular/service-worker": "~13.0.3",
    "@asymmetrik/ngx-leaflet": "^7.0.0",
    "@auth0/angular-jwt": "^5.1.0",
    "@ckeditor/ckeditor5-angular": "^1.2.3",
    "@ckeditor/ckeditor5-build-classic": "^20.0.0",
    "@ckeditor/ckeditor5-build-inline": "^20.0.0",
    "@ctrl/ngx-emoji-mart": "^3.1.0",
    "@kolkov/angular-editor": "^1.1.2",
    "@ks89/angular-modal-gallery": "^7.2.5",
    "@ng-bootstrap/ng-bootstrap": "^6.1.0",
    "@ng-select/ng-select": "^4.0.0",
    "@ngx-loading-bar/core": "^5.1.0",
    "@ngx-loading-bar/http-client": "^5.1.0",
    "@ngx-loading-bar/router": "^5.1.0",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "@sweetalert2/ngx-sweetalert2": "^8.1.1",
    "@swimlane/ngx-charts": "^14.0.0",
    "@swimlane/ngx-datatable": "^17.1.0",
    "angular-archwizard": "^6.1.0",
    "angular-calendar": "^0.28.16",
    "angular-count-to": "0.0.3",
    "angular-tree-component": "^8.5.6",
    "angular2_photoswipe": "^8.0.1",
    "angular2-knob": "^1.1.15",
    "angular2-multiselect-dropdown": "^4.6.3",
    "angularx-flatpickr": "^6.3.1",
    "animate.css": "^4.1.0",
    "apexcharts": "^3.19.3",
    "bootstrap": "^4.5.2",
    "canvasjs": "^1.8.3",
    "chart.js": "^2.9.3",
    "chartist": "^0.11.4",
    "crypto": "^1.0.1",
    "crypto-js": "^4.1.1",
    "date-fns": "^2.14.0",
    "feather-icons": "^4.26.0",
    "file-saver": "^2.0.5",
    "firebase": "^7.15.5",
    "flatpickr": "^4.6.3",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "knob": "^1.1.0",
    "leaflet": "^1.6.0",
    "mousetrap": "^1.6.5",
    "ng-apexcharts": "^1.3.0",
    "ng-chartist": "^4.1.0",
    "ng-pick-datetime": "^7.0.0",
    "ng2-charts": "^2.3.2",
    "ng2-dragula": "^2.1.1",
    "ng2-google-charts": "^6.0.0",
    "ng2-search-filter": "^0.5.1",
    "ng5-slider": "^1.2.4",
    "ngx-ckeditor": "^8.0.0",
    "ngx-cookie-service": "^3.0.3",
    "ngx-crystal-gallery": "^1.1.5",
    "ngx-datatable": "^1.0.3",
    "ngx-dropzone": "^2.5.0",
    "ngx-dropzone-wrapper": "^9.0.0",
    "ngx-editor": "^5.0.0-alpha.9",
    "ngx-image-cropper": "^3.1.9",
    "ngx-joyride": "^2.2.11",
    "ngx-masonry": "^10.0.0",
    "ngx-masonry-gallery": "^3.0.0",
    "ngx-owl-carousel-o": "^3.0.1",
    "ngx-perfect-scrollbar": "^9.0.0",
    "ngx-print": "^1.2.0-beta.5",
    "ngx-router-animations": "0.0.9",
    "ngx-toastr": "^12.1.0",
    "photoswipe": "^4.1.3",
    "rxjs": "~6.5.5",
    "sweetalert2": "^9.14.4",
    "tslib": "^2.0.0",
    "xlsx": "^0.18.5",
    "xlsx-style": "^0.8.13",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.0.4",
    "@angular/cli": "~13.0.4",
    "@angular/compiler-cli": "~13.0.3",
    "@angular/language-service": "~13.0.3",
    "@schematics/angular": "^14.2.1",
    "@types/chartist": "^0.9.48",
    "@types/crypto-js": "^4.1.1",
    "@types/feather-icons": "^4.7.0",
    "@types/hammerjs": "^2.0.36",
    "@types/jasmine": "~3.5.11",
    "@types/jasminewd2": "~2.0.3",
    "@types/leaflet": "^1.5.13",
    "@types/mousetrap": "^1.6.3",
    "@types/node": "^14.18.34",
    "codelyzer": "^5.2.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.10.2",
    "tslint": "~6.1.0",
    "typescript": "~4.4.4"
  }
}

if Angular version is from 7.0.0 - 14.1.0 use command npm i ngx-print@1.2.1

if Angular version is >14
use command npm install ngx-print

it works fine for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM