npm 更新后的 angular-cli 构建错误 [英] angular-cli build errors after npm update

查看:22
本文介绍了npm 更新后的 angular-cli 构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

切换到具有更新节点版本等的新电脑后.尝试使用 angular cli 构建我的 angular 项目时出现以下错误:

After switching to my new pc, which has newer node versiones etc. I get the following error when trying to build my angular project set up with angular cli:

开始:

10% 构建模块 2/2 模块 0 活动(节点:14472)弃用警告:不推荐使用 Tapable.plugin.使用新的 API.hooks 代替

10% building modules 2/2 modules 0 active(node:14472) DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead

后来:

错误:Chunk.parents:改用 ChunkGroup.getParents()

Error: Chunk.parents: Use ChunkGroup.getParents() instead

未在 google 中找到此错误的任何结果

Didn't find any results for this error in google

  • npm 版本:5.7.1
  • v8.9.0

包配置:

{
  "name": "...",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "build": "webpack",
    "build-css": "node build-sass.js",
    "test": "karma start ./karma.conf.js",
    "lint": "ng lint",
    "e2e": "protractor ./protractor.conf.js",
    "pree2e": "webdriver-manager update --standalone false --gecko false --quiet"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular-devkit/core": "0.3.1",
    "@angular/cli": "~1.7.0",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@cityofzion/neon-js": "3.2.1",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0",
    "@ngtools/webpack": "1.10.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "aes-js": "^3.1.0",
    "autoprefixer": "^7.2.3",
    "bootstrap": "^4.0.0",
    "circular-dependency-plugin": "^4.2.1",
    "codelyzer": "^4.0.1",
    "copy-webpack-plugin": "~4.4.2",
    "fast-sha256": "^1.1.0",
    "file-loader": "^1.1.5",
    "file-system": "^2.2.2",
    "html-webpack-plugin": "^2.29.0",
    "istanbul-instrumenter-loader": "^3.0.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "less-loader": "^4.0.5",
    "node-sass": "^4.7.2",
    "node-sass-tilde-importer": "^1.0.1",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.10",
    "postcss-url": "^7.1.2",
    "protractor": "~5.1.2",
    "raw-loader": "^0.5.1",
    "sass-loader": "^6.0.6",
    "style-loader": "^0.19.1",
    "stylus-loader": "^3.0.1",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3",
    "uglifyjs-webpack-plugin": "^1.1.8",
    "url-loader": "^0.6.2",
    "webpack": "~3.11.0",
    "webpack-dev-server": "~2.11.0"
  }
}

完整的错误信息:

_>webpack
 10% building modules 2/2 modules 0 active(node:14472) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead                                                               76% basic chunk optimizationPATHnode_modules\webpack\lib\Chunk.js:438
                throw new Error("Chunk.parents: Use ChunkGroup.getParents() instead");
                ^

Error: Chunk.parents: Use ChunkGroup.getParents() instead
    at Chunk.get (PATHnode_modules\webpack\lib\Chunk.js:438:9)
    at CommonsChunkPlugin.getAffectedChunks (PATHPROJECT\webpack\lib\optimize\CommonsChunkPlugin.js:268:18)
    at targetChunks.forEach (PATHPROJECT\webpack\lib\optimize\CommonsChunkPlugin.js:110:34)
    at Array.forEach (<anonymous>)
    at compilation.plugin (PATHPROJECT\webpack\lib\optimize\CommonsChunkPlugin.js:105:18)
    at SyncBailHook.eval [as call] (eval at create (PATHnode_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:17:12), <anonymous>:7:16)
    at SyncBailHook.lazyCompileHook [as _call] (PATHnode_modules\webpack\node_modules\tapable\lib\Hook.js:35:21)
    at Compilation.seal (PATHnode_modules\webpack\lib\Compilation.js:874:30)
    at hooks.make.callAsync.err (PATHnode_modules\webpack\lib\Compiler.js:464:17)
    at _done (eval at create (PATHnode_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:9:1)
    at _err2 (eval at create (PATHnode_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:44:22)
    at _addModuleChain (PATHnode_modules\webpack\lib\Compilation.js:749:12)
    at processModuleDependencies.err (PATHnode_modules\webpack\lib\Compilation.js:688:9)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

推荐答案

我通过降级我的 global webpack 版本从 4.0.1 解决了这个问题强> 到 3.11.0

I solved this problem by downgrading my global webpack version from 4.0.1 to 3.11.0

npm i -g webpack@3.11.0

这篇关于npm 更新后的 angular-cli 构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆