./node_modules/@angular/core/esm5/core.js中的错误找不到模块:TypeError:dep.isEqualResource不是函数

时间:2018-03-21 11:11:52

标签: node.js angular webpack angular-cli

我已经更新了我的Angular项目中的package.json,当我运行 ng serve

时,使用命令ncu -u更新后得到以下错误

./node_modules/@angular/core/esm5/core.js中的错误 找不到模块:TypeError:dep.isEqualResource不是函数

尝试卸载节点模块并重新安装但没有运气

在下面添加Package.json。

{
"name": "material",
  "private": true,
  "version": "1.0.0",
  "main": "",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "hmr": "ng serve --hmr -e=hmr",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "clean": "rimraf node_modules",
    "clean-all": "rimraf node_modules dist dll && npm cache clean",
    "reinstall": "rimraf node_modules && rm -f package-lock.json && npm install"
  },
  "dependencies": {
    "@angular/animations": "^5.2.9",
    "@angular/cdk": "^5.2.4",
    "@angular/common": "^5.2.9",
    "@angular/compiler": "^5.2.9",
    "@angular/core": "^5.2.9",
    "@angular/forms": "^5.2.9",
    "@angular/http": "^5.2.9",
    "@angular/material": "5.2.4",
    "@angular/platform-browser": "^5.2.9",
    "@angular/platform-browser-dynamic": "^5.2.9",
    "@angular/platform-server": "^5.2.9",
    "@angular/router": "^5.2.9",
    "@types/underscore": "^1.8.8",
    "angular-localstorage": "^1.1.5",
    "angular2-csv": "^0.2.5",
    "angular2-debounce": "^1.0.4",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.3",
    "cors": "^2.8.4",
    "easy-pie-chart": "^2.1.7",
    "echarts": "^4.0.4",
    "font-awesome": "^4.7.0",
    "intl": "^1.2.5",
    "jquery": "^3.3.1",
    "jquery-slimscroll": "^1.3.8",
    "jsonwebtoken": "^8.2.0",
    "jspdf": "^1.3.5",
    "jspdf-autotable": "^2.3.2",
    "ng-circle-progress": "^0.9.9",
    "ng2-toasty": "^4.0.3",
    "ng2modules-easypiechart": "0.0.4",
    "ngx-filter-pipe": "^2.1.0",
    "reflect-metadata": "^0.1.12",
    "rxjs": "^5.5.7",
    "underscore": "^1.8.3",
    "webfontloader": "^1.6.28",
    "zone.js": "^0.8.20"
  },
  "devDependencies": {
    "@angular/cli": "1.7.3",
    "@angular/compiler-cli": "^5.2.9",
    "@angularclass/hmr": "^2.1.3",
    "@angularclass/hmr-loader": "^3.0.4",
    "@auth0/angular-jwt": "^1.1.0",
    "@types/core-js": "^0.9.46",
    "@types/hammerjs": "^2.0.34",
    "@types/jasmine": "^2.8.6",
    "@types/jquery": "^3.3.1",
    "@types/node": "^9.4.7",
    "add-asset-html-webpack-plugin": "^2.1.3",
    "angular-router-loader": "^0.8.2",
    "angular2-template-loader": "^0.6.2",
    "autoprefixer": "^8.1.0",
    "awesome-typescript-loader": "^4.0.1",
    "bootstrap": "^4.0.0",
    "clarity-angular": "^0.10.27",
    "codelyzer": "^4.2.1",
    "copy-webpack-plugin": "^4.5.1",
    "css-loader": "^0.28.11",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^1.1.11",
    "hammerjs": "^2.0.8",
    "html-webpack-plugin": "^3.0.7",
    "json-loader": "^0.5.4",
    "material-design-lite": "^1.3.0",
    "moment": "^2.21.0",
    "ng-router-loader": "^2.1.0",
    "node-sass": "^4.8.2",
    "postcss-loader": "^2.1.3",
    "raw-loader": "^0.5.1",
    "rimraf": "^2.6.2",
    "sass-loader": "^6.0.7",
    "style-loader": "^0.20.3",
    "ts-helpers": "^1.1.2",
    "ts-node": "^5.0.1",
    "tslib": "^1.9.0",
    "tslint": "^5.9.1",
    "tslint-loader": "^3.6.0",
    "typescript": "^2.7.2",
    "webpack": "^4.2.0",
    "webpack-dev-server": "^3.1.1",
    "webpack-dll-bundles-plugin": "^1.0.0-beta.5",
    "webpack-merge": "^4.1.2"
  },
  "engines": {
    "node": ">=6.9.0",
    "npm": ">= 3"
  }
}

2 个答案:

答案 0 :(得分:0)

这可能与您的引擎版本有关,请尝试将它们设置为

"node": "8.10.0",
"npm": "5.6.0"

因为这是我现在正在运行的并运行npm install

答案 1 :(得分:-1)

我有同样的问题。我通过删除devDepencies列表中的webpack相关包解决了这个问题。 "@angular/cli"包处理所有webpack工作。

在您的示例中

删除那些行,而不是再次运行npm install命令:

"webpack": "^4.2.0",
    "webpack-dev-server": "^3.1.1",
    "webpack-dll-bundles-plugin": "^1.0.0-beta.5",
    "webpack-merge": "^4.1.2"

我希望它对你有用。