'compilation' 参数必须是 Compilation 的实例
The 'compilation' argument must be an instance of Compilation
在我的 Angular 12.0.2 项目 运行 'ng build' 上出现此错误
./src/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: The 'compilation' argument must be an instance of Compilation
at getCompilationHooks (D:\Dev\Git_Merc\mercury\node_modules\webpack\lib\javascript\JavascriptModulesPlugin.js:125:10)
at D:\Dev\Git_Merc\mercury\node_modules\webpack\lib\javascript\CommonJsChunkFormatPlugin.js:43:19
at Hook.eval [as call] (eval at create (D:\Dev\Git_Merc\mercury\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
at Hook.CALL_DELEGATE [as _call] (D:\Dev\Git_Merc\mercury\node_modules\tapable\lib\Hook.js:14:14)
at Compiler.newCompilation (D:\Dev\Git_Merc\mercury\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:1030:30)
at D:\Dev\Git_Merc\mercury\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:1073:29
at Hook.eval [as callAsync] (eval at create (D:\Dev\Git_Merc\mercury\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\Dev\Git_Merc\mercury\node_modules\tapable\lib\Hook.js:18:14)
at Compiler.compile (D:\Dev\Git_Merc\mercury\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:1068:28)
at Compiler.runAsChild (D:\Dev\Git_Merc\mercury\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:520:8)
我一直在谷歌搜索,但找不到任何可以解决我的问题的方法。我不确定是什么触发了这个。
版本:
Angular CLI: 12.0.2
Node: 14.17.0
Package Manager: npm 7.14.0
OS: win32 x64
Angular: 12.0.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1200.2
@angular-devkit/build-angular 12.0.2
@angular-devkit/build-optimizer 0.1200.2
@angular-devkit/core 12.0.2
@angular-devkit/schematics 12.0.2
@angular/cli 12.0.2
@schematics/angular 12.0.2
ng-packagr 12.0.2
rxjs 7.1.0
typescript 4.2.4
webpack 5.38.0
更新 1 - 添加@Heretic Monkey 请求的信息
我运行的命令是ng build
。
我的angular.json
如下:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"Agent-Angular": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/Agent-Angular",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/web.config"
],
"styles": [
"src/styles.scss",
"node_modules/@mercury/merc-pattern-lib/styles.scss"
],
"scripts": [
"node_modules/popper.js/dist/umd/popper.min.js"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"local": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.local.ts"
}
]
},
"nonprod": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.nonprod.ts"
}
]
},
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "Agent-Angular:build"
},
"configurations": {
"local": {
"browserTarget": "Agent-Angular:build:local"
},
"nonprod": {
"browserTarget": "Agent-Angular:build:nonprod"
},
"production": {
"browserTarget": "Agent-Angular:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "Agent-Angular:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets",
"src/web.config"
],
"styles": [
"src/styles.scss"
],
"scripts": [
"node_modules/popper.js/dist/umd/popper.min.js"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "Agent-Angular:serve"
},
"configurations": {
"production": {
"devServerTarget": "Agent-Angular:serve:production"
}
}
}
}
},
"cee-ctilib": {
"projectType": "library",
"root": "projects/cee-ctilib",
"sourceRoot": "projects/cee-ctilib/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/cee-ctilib/tsconfig.lib.json",
"project": "projects/cee-ctilib/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/cee-ctilib/src/test.ts",
"tsConfig": "projects/cee-ctilib/tsconfig.spec.json",
"karmaConfig": "projects/cee-ctilib/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/cee-ctilib/tsconfig.lib.json",
"projects/cee-ctilib/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"entities": {
"projectType": "library",
"root": "projects/entities",
"sourceRoot": "projects/entities/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/entities/tsconfig.lib.json",
"project": "projects/entities/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/entities/src/test.ts",
"tsConfig": "projects/entities/tsconfig.spec.json",
"karmaConfig": "projects/entities/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/entities/tsconfig.lib.json",
"projects/entities/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "Agent-Angular",
"cli": {
"analytics": false,
"defaultCollection": "@ngrx/schematics"
}
}
更新 2 - 添加 package.json
{
"name": "agent-angular",
"version": "0.0.0",
"description": "Mercury Chat Application",
"scripts": {
"ng": "ng",
"format:src": "prettier --config ./prettier.config.js --ignore-path ./.prettierignore --write \"src/**/*.\"{ts,js,json,scss,less,css}",
"format:projects": "prettier --config ./prettier.config.js --ignore-path ./.prettierignore --write \"projects/**/*.\"{ts,js,json,scss,less,css}",
"format:e2e": "prettier --config ./prettier.config.js --ignore-path ./.prettierignore --write \"e2e/**/*.\"{ts,js,json,scss,less,css}",
"format:root": "prettier --config ./prettier.config.js --ignore-path ./.prettierignore --write \"*.\"{ts,js,json,scss,less,css}",
"format:all": "npm run format:src && npm run format:projects && npm run format:e2e && npm run format:root",
"lint": "ng lint",
"e2e": "ng e2e",
"start": "npm run && ng serve --prod",
"build": "npm run && ng build --prod --base-href=./",
"build:dev": "npm run && ng build",
"unit:test": "ng test",
"unit:test:main": "ng test Agent-Angular --code-coverage",
"unit:test:entities": "ng test entities --code-coverage",
"unit:test:cee-ctilib": "ng test cee-ctilib --code-coverage",
"unit:test:debug": "ng test --browsers Chrome --watch true",
"unit:test:entities:debug": "ng test entities --browsers Chrome --watch true",
"start:local": "ng serve -c local --host local.mercury.comcast.net --port 443 --ssl --ssl-key ./cert/local.mercury.comcast.net.key --ssl-cert ./cert/local.mercury.comcast.net.crt",
"start:dev": "ng serve -c dev --host dev.mercury.comcast.net --port 443 --ssl --ssl-key ./cert/localhost.key --ssl-cert ./cert/localhost.crt",
"build:cti": "ng-packagr -p ./projects/cee-ctilib/ng-package.json && cd ./dist && npm pack ./cee-ctilib",
"build:header": "ng-packagr -p ./projects/header/ng-package.json && cd ./dist && npm pack ./header",
"build:convo-header": "ng-packagr -p ./projects/convo-header/ng-package.json && cd ./dist && npm pack ./convo-header",
"build:convo-details": "ng-packagr -p ./projects/convo-details/ng-package.json && cd ./dist && npm pack ./convo-details",
"build:convo-list": "ng-packagr -p ./projects/convo-list/ng-package.json && cd ./dist && npm pack ./convo-list",
"build:convo-window": "ng-packagr -p ./projects/convo-window/ng-package.json && cd ./dist && npm pack ./convo-window",
"build:agent-settings": "ng-packagr -p ./projects/agent-settings/ng-package.json && cd ./dist && npm pack ./agent-settings",
"build:entities": "ng-packagr -p ./projects/entities/ng-package.json && cd ./dist && npm pack ./entities",
"build:all-libraries": "npm run build:cti && npm run build:header && npm run build:convo-header && npm run build:convo-details && npm run build:convo-list && npm run build:convo-window && npm run build:agent-settings && npm run build:entities",
"refreshNpmrc": "vsts-npm-auth -config .npmrc",
"prepareForPr": "ng lint --fix && ng build --prod && ng test"
},
"private": false,
"dependencies": {
"@angular/animations": "12.0.1",
"@angular/common": "12.0.1",
"@angular/compiler": "12.0.1",
"@angular/core": "12.0.1",
"@angular/forms": "12.0.1",
"@angular/platform-browser": "12.0.1",
"@angular/platform-browser-dynamic": "12.0.1",
"@angular/router": "12.0.1",
"@auth0/angular-jwt": "^5.0.2",
"@azure/msal-angular": "^2.0.0-beta.1",
"@azure/msal-browser": "^2.12.1",
"@ctrl/ngx-emoji-mart": "^5.1.0",
"@jsier/retrier": "^1.2.4",
"@mercury/merc-ng-core": "^5.1.0",
"@mercury/merc-pattern-lib": "^2.11.0",
"@microsoft/applicationinsights-web": "^2.5.11",
"@microsoft/signalr": "^5.0.6",
"@ngrx/effects": "^12.0.0",
"@ngrx/entity": "^12.0.0",
"@ngrx/store": "^12.0.0",
"angular-oauth2-oidc": "^10.0.3",
"dayjs": "^1.10.4",
"guid-typescript": "^1.0.9",
"ngx-quill": "^13.2.0",
"npm": "^6.14.11",
"popper": "^1.0.1",
"popper.js": "1.16.0",
"quill": "^1.3.7",
"quill-placeholder-module": "^0.3.1",
"rxjs": "^7.0.1",
"ts-retry": "^2.3.1",
"tslib": "^2.2.0",
"vsts-npm-auth": "^0.41.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.0.0",
"@angular-devkit/build-optimizer": "^0.1200.0",
"@angular/cli": "^12.0.1",
"@angular/compiler-cli": "12.0.1",
"@angular/language-service": "12.0.1",
"@ngrx/schematics": "^12.0.0",
"@ngrx/store-devtools": "^12.0.0",
"@types/deep-freeze": "^0.1.2",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "2.0.8",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"deep-freeze": "^0.0.1",
"jasmine-core": "~3.7.1",
"jasmine-json-test-reporter": "1.0.0-beta",
"jasmine-marbles": "0.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "^6.3.2",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-htmlfile-reporter": "^0.3.8",
"karma-jasmine": "^4.0.1",
"karma-jasmine-html-reporter": "^1.6.0",
"karma-json-reporter": "^1.2.1",
"karma-typescript-es6-transform": "^5.5.1",
"karma-webpack": "^5.0.0",
"mockdate": "^3.0.5",
"ng-packagr": "^12.0.0",
"prettier": "1.18.2",
"protractor": "~7.0.0",
"protractor-jasmine2-html-reporter": "0.0.7",
"rxjs-marbles": "^7.0.0",
"ts-node": "8.4.1",
"tslint": "^6.1.3",
"typescript": "4.2.4",
"webpack": "^5.37.1"
},
"author": "Mercury Team",
"license": ""
}
我们想通了。正如您在我们的 packages.json
中看到的,我们依赖于 webpack
。 angular-devkit/build-angular
似乎也是如此。我们认为这造成了多个 webpack 冲突并导致问题的已知问题。删除我们对 webpack
的依赖解决了这个问题。
是的,这个问题与 2 个不同的 webpack 库有关。
要解决添加到您的 package.json 下一个块的问题:
"resolutions": {
"webpack": "5.41.1"
},
在我的例子中,这是错误的路径。
我 运行 来自 git Bash 的命令有错误的驼峰式字母。
赞:c://Dev/Product
而不是:c://dev/Product
修复了路径并且它有效。
我在 Angular 13 的“运行 ng”测试中遇到了类似的问题。
"dependencies": {
"ngx-build-plus": "^13.0.1", // requires webpack 5.70.0
.....
"devDependencies": {
"@angular-devkit/build-angular": "13.2.4", // requires webpack 5.67.0
-->
"devDependencies": {
"@angular-devkit/build-angular": "13.3.0", // requires webpack 5.70.0
这通常发生在 webpack 是多个包的依赖项时。锁定 package-lock.json 并搜索“webpack”依赖项是我的方法。 “npm dedupe”有时可以解决此类问题。
在我的 Angular 12.0.2 项目 运行 'ng build' 上出现此错误
./src/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: The 'compilation' argument must be an instance of Compilation
at getCompilationHooks (D:\Dev\Git_Merc\mercury\node_modules\webpack\lib\javascript\JavascriptModulesPlugin.js:125:10)
at D:\Dev\Git_Merc\mercury\node_modules\webpack\lib\javascript\CommonJsChunkFormatPlugin.js:43:19
at Hook.eval [as call] (eval at create (D:\Dev\Git_Merc\mercury\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
at Hook.CALL_DELEGATE [as _call] (D:\Dev\Git_Merc\mercury\node_modules\tapable\lib\Hook.js:14:14)
at Compiler.newCompilation (D:\Dev\Git_Merc\mercury\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:1030:30)
at D:\Dev\Git_Merc\mercury\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:1073:29
at Hook.eval [as callAsync] (eval at create (D:\Dev\Git_Merc\mercury\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\Dev\Git_Merc\mercury\node_modules\tapable\lib\Hook.js:18:14)
at Compiler.compile (D:\Dev\Git_Merc\mercury\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:1068:28)
at Compiler.runAsChild (D:\Dev\Git_Merc\mercury\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:520:8)
我一直在谷歌搜索,但找不到任何可以解决我的问题的方法。我不确定是什么触发了这个。
版本:
Angular CLI: 12.0.2
Node: 14.17.0
Package Manager: npm 7.14.0
OS: win32 x64
Angular: 12.0.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1200.2
@angular-devkit/build-angular 12.0.2
@angular-devkit/build-optimizer 0.1200.2
@angular-devkit/core 12.0.2
@angular-devkit/schematics 12.0.2
@angular/cli 12.0.2
@schematics/angular 12.0.2
ng-packagr 12.0.2
rxjs 7.1.0
typescript 4.2.4
webpack 5.38.0
更新 1 - 添加@Heretic Monkey 请求的信息
我运行的命令是ng build
。
我的angular.json
如下:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"Agent-Angular": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/Agent-Angular",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/web.config"
],
"styles": [
"src/styles.scss",
"node_modules/@mercury/merc-pattern-lib/styles.scss"
],
"scripts": [
"node_modules/popper.js/dist/umd/popper.min.js"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"local": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.local.ts"
}
]
},
"nonprod": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.nonprod.ts"
}
]
},
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "Agent-Angular:build"
},
"configurations": {
"local": {
"browserTarget": "Agent-Angular:build:local"
},
"nonprod": {
"browserTarget": "Agent-Angular:build:nonprod"
},
"production": {
"browserTarget": "Agent-Angular:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "Agent-Angular:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets",
"src/web.config"
],
"styles": [
"src/styles.scss"
],
"scripts": [
"node_modules/popper.js/dist/umd/popper.min.js"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "Agent-Angular:serve"
},
"configurations": {
"production": {
"devServerTarget": "Agent-Angular:serve:production"
}
}
}
}
},
"cee-ctilib": {
"projectType": "library",
"root": "projects/cee-ctilib",
"sourceRoot": "projects/cee-ctilib/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/cee-ctilib/tsconfig.lib.json",
"project": "projects/cee-ctilib/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/cee-ctilib/src/test.ts",
"tsConfig": "projects/cee-ctilib/tsconfig.spec.json",
"karmaConfig": "projects/cee-ctilib/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/cee-ctilib/tsconfig.lib.json",
"projects/cee-ctilib/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"entities": {
"projectType": "library",
"root": "projects/entities",
"sourceRoot": "projects/entities/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/entities/tsconfig.lib.json",
"project": "projects/entities/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/entities/src/test.ts",
"tsConfig": "projects/entities/tsconfig.spec.json",
"karmaConfig": "projects/entities/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/entities/tsconfig.lib.json",
"projects/entities/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "Agent-Angular",
"cli": {
"analytics": false,
"defaultCollection": "@ngrx/schematics"
}
}
更新 2 - 添加 package.json
{
"name": "agent-angular",
"version": "0.0.0",
"description": "Mercury Chat Application",
"scripts": {
"ng": "ng",
"format:src": "prettier --config ./prettier.config.js --ignore-path ./.prettierignore --write \"src/**/*.\"{ts,js,json,scss,less,css}",
"format:projects": "prettier --config ./prettier.config.js --ignore-path ./.prettierignore --write \"projects/**/*.\"{ts,js,json,scss,less,css}",
"format:e2e": "prettier --config ./prettier.config.js --ignore-path ./.prettierignore --write \"e2e/**/*.\"{ts,js,json,scss,less,css}",
"format:root": "prettier --config ./prettier.config.js --ignore-path ./.prettierignore --write \"*.\"{ts,js,json,scss,less,css}",
"format:all": "npm run format:src && npm run format:projects && npm run format:e2e && npm run format:root",
"lint": "ng lint",
"e2e": "ng e2e",
"start": "npm run && ng serve --prod",
"build": "npm run && ng build --prod --base-href=./",
"build:dev": "npm run && ng build",
"unit:test": "ng test",
"unit:test:main": "ng test Agent-Angular --code-coverage",
"unit:test:entities": "ng test entities --code-coverage",
"unit:test:cee-ctilib": "ng test cee-ctilib --code-coverage",
"unit:test:debug": "ng test --browsers Chrome --watch true",
"unit:test:entities:debug": "ng test entities --browsers Chrome --watch true",
"start:local": "ng serve -c local --host local.mercury.comcast.net --port 443 --ssl --ssl-key ./cert/local.mercury.comcast.net.key --ssl-cert ./cert/local.mercury.comcast.net.crt",
"start:dev": "ng serve -c dev --host dev.mercury.comcast.net --port 443 --ssl --ssl-key ./cert/localhost.key --ssl-cert ./cert/localhost.crt",
"build:cti": "ng-packagr -p ./projects/cee-ctilib/ng-package.json && cd ./dist && npm pack ./cee-ctilib",
"build:header": "ng-packagr -p ./projects/header/ng-package.json && cd ./dist && npm pack ./header",
"build:convo-header": "ng-packagr -p ./projects/convo-header/ng-package.json && cd ./dist && npm pack ./convo-header",
"build:convo-details": "ng-packagr -p ./projects/convo-details/ng-package.json && cd ./dist && npm pack ./convo-details",
"build:convo-list": "ng-packagr -p ./projects/convo-list/ng-package.json && cd ./dist && npm pack ./convo-list",
"build:convo-window": "ng-packagr -p ./projects/convo-window/ng-package.json && cd ./dist && npm pack ./convo-window",
"build:agent-settings": "ng-packagr -p ./projects/agent-settings/ng-package.json && cd ./dist && npm pack ./agent-settings",
"build:entities": "ng-packagr -p ./projects/entities/ng-package.json && cd ./dist && npm pack ./entities",
"build:all-libraries": "npm run build:cti && npm run build:header && npm run build:convo-header && npm run build:convo-details && npm run build:convo-list && npm run build:convo-window && npm run build:agent-settings && npm run build:entities",
"refreshNpmrc": "vsts-npm-auth -config .npmrc",
"prepareForPr": "ng lint --fix && ng build --prod && ng test"
},
"private": false,
"dependencies": {
"@angular/animations": "12.0.1",
"@angular/common": "12.0.1",
"@angular/compiler": "12.0.1",
"@angular/core": "12.0.1",
"@angular/forms": "12.0.1",
"@angular/platform-browser": "12.0.1",
"@angular/platform-browser-dynamic": "12.0.1",
"@angular/router": "12.0.1",
"@auth0/angular-jwt": "^5.0.2",
"@azure/msal-angular": "^2.0.0-beta.1",
"@azure/msal-browser": "^2.12.1",
"@ctrl/ngx-emoji-mart": "^5.1.0",
"@jsier/retrier": "^1.2.4",
"@mercury/merc-ng-core": "^5.1.0",
"@mercury/merc-pattern-lib": "^2.11.0",
"@microsoft/applicationinsights-web": "^2.5.11",
"@microsoft/signalr": "^5.0.6",
"@ngrx/effects": "^12.0.0",
"@ngrx/entity": "^12.0.0",
"@ngrx/store": "^12.0.0",
"angular-oauth2-oidc": "^10.0.3",
"dayjs": "^1.10.4",
"guid-typescript": "^1.0.9",
"ngx-quill": "^13.2.0",
"npm": "^6.14.11",
"popper": "^1.0.1",
"popper.js": "1.16.0",
"quill": "^1.3.7",
"quill-placeholder-module": "^0.3.1",
"rxjs": "^7.0.1",
"ts-retry": "^2.3.1",
"tslib": "^2.2.0",
"vsts-npm-auth": "^0.41.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.0.0",
"@angular-devkit/build-optimizer": "^0.1200.0",
"@angular/cli": "^12.0.1",
"@angular/compiler-cli": "12.0.1",
"@angular/language-service": "12.0.1",
"@ngrx/schematics": "^12.0.0",
"@ngrx/store-devtools": "^12.0.0",
"@types/deep-freeze": "^0.1.2",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "2.0.8",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"deep-freeze": "^0.0.1",
"jasmine-core": "~3.7.1",
"jasmine-json-test-reporter": "1.0.0-beta",
"jasmine-marbles": "0.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "^6.3.2",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-htmlfile-reporter": "^0.3.8",
"karma-jasmine": "^4.0.1",
"karma-jasmine-html-reporter": "^1.6.0",
"karma-json-reporter": "^1.2.1",
"karma-typescript-es6-transform": "^5.5.1",
"karma-webpack": "^5.0.0",
"mockdate": "^3.0.5",
"ng-packagr": "^12.0.0",
"prettier": "1.18.2",
"protractor": "~7.0.0",
"protractor-jasmine2-html-reporter": "0.0.7",
"rxjs-marbles": "^7.0.0",
"ts-node": "8.4.1",
"tslint": "^6.1.3",
"typescript": "4.2.4",
"webpack": "^5.37.1"
},
"author": "Mercury Team",
"license": ""
}
我们想通了。正如您在我们的 packages.json
中看到的,我们依赖于 webpack
。 angular-devkit/build-angular
似乎也是如此。我们认为这造成了多个 webpack 冲突并导致问题的已知问题。删除我们对 webpack
的依赖解决了这个问题。
是的,这个问题与 2 个不同的 webpack 库有关。 要解决添加到您的 package.json 下一个块的问题:
"resolutions": {
"webpack": "5.41.1"
},
在我的例子中,这是错误的路径。
我 运行 来自 git Bash 的命令有错误的驼峰式字母。
赞:c://Dev/Product
而不是:c://dev/Product
修复了路径并且它有效。
我在 Angular 13 的“运行 ng”测试中遇到了类似的问题。
"dependencies": {
"ngx-build-plus": "^13.0.1", // requires webpack 5.70.0
.....
"devDependencies": {
"@angular-devkit/build-angular": "13.2.4", // requires webpack 5.67.0
-->
"devDependencies": {
"@angular-devkit/build-angular": "13.3.0", // requires webpack 5.70.0
这通常发生在 webpack 是多个包的依赖项时。锁定 package-lock.json 并搜索“webpack”依赖项是我的方法。 “npm dedupe”有时可以解决此类问题。