错误:在Angular Webpack插件初始化之前尝试发射(错误:在Angular Webpack插件初始化之前尝试发出)

t1qtbnec  于 2023-10-19  发布在  Webpack
关注(0)|答案(1)|浏览(189)

在这里,我做的是我在Angular 15中创建了一个新项目,并将代码从Angular版本5中移走。我已经修复了所有的错误,但坚持这个错误。这里也是我目前的Angular版本的详细信息:
Angular CLI:15.2.10节点:18.18.2包管理器:npm 10.2.0操作系统:win32 x64
我得到以下错误:[错误]:https://i.stack.imgur.com/22xkl.png

package.json文件如下:

  1. {
  2. "name": "demo",
  3. "version": "0.0.0",
  4. "scripts": {
  5. "ng": "ng",
  6. "start": "ng serve",
  7. "build": "ng build",
  8. "prod": "node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build --prod",
  9. "test": "ng test",
  10. "lint": "ng lint",
  11. "e2e": "ng e2e",
  12. "build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --
  13. prod"
  14. },
  15. "private": true,
  16. "dependencies": {
  17. "@agm/core": "^1.0.0-beta.3",
  18. "@angular/animations": "^15.0.0",
  19. "@angular/common": "^15.0.0",
  20. "@angular/compiler": "^15.0.0",
  21. "@angular/core": "^15.2.10",
  22. "@angular/forms": "^15.0.0",
  23. "@angular/platform-browser": "^15.0.0",
  24. "@angular/platform-browser-dynamic": "^15.0.0",
  25. "@angular/router": "^15.0.0",
  26. "@ngtools/webpack": "^14.2.3",
  27. "@ngui/datetime-picker": "^0.16.2",
  28. "@progress/kendo-angular-charts": "^3.8.0",
  29. "@progress/kendo-angular-common": "^3.2.1",
  30. "@progress/kendo-angular-dropdowns": "^3.5.2",
  31. "@progress/kendo-angular-intl": "^1.7.0",
  32. "@progress/kendo-angular-l10n": "^1.3.0",
  33. "@progress/kendo-angular-pdf-export": "^1.3.1",
  34. "@progress/kendo-drawing": "^1.17.1",
  35. "@progress/kendo-licensing": "^1.2.2",
  36. "@syncfusion/ej2-angular-richtexteditor": "^17.4.40",
  37. "@types/angular-ui-bootstrap": "^0.13.44",
  38. "@types/d3": "^5.7.2",
  39. "@types/jquery": "^3.3.29",
  40. "@types/jqueryui": "^1.12.7",
  41. "@types/underscore": "^1.8.14",
  42. "admin-lte-css": "^2.4.3",
  43. "angular-checklist": "^1.3.0",
  44. "angular-sortablejs": "^2.7.0",
  45. "angular2-datetimepicker": "^1.1.1",
  46. "angular2-image-zoom": "^1.2.1",
  47. "angular2-json2csv": "^1.1.2",
  48. "angular2-tag-input": "^1.2.3",
  49. "babel-regenerator-runtime": "^6.5.0",
  50. "bootstrap": "^3.4.1",
  51. "bootstrap-css-only": "^3.3.7",
  52. "chart.js": "^2.9.4",
  53. "core-js": "^2.6.5",
  54. "d3": "^5.9.2",
  55. "font-awesome": "^4.7.0",
  56. "hammerjs": "^2.0.8",
  57. "html2canvas": "^1.0.0-rc.1",
  58. "ionicons": "^2.0.1",
  59. "jquery": "^3.6.0",
  60. "jquery-ui-sortable": "^1.0.0",
  61. "jqueryui": "^1.11.1",
  62. "jspdf": "^1.5.3",
  63. "lodash": "^4.17.21",
  64. "moment": "^2.24.0",
  65. "ng-pick-datetime": "^5.2.6",
  66. "ng-pick-datetime-moment": "1.0.7",
  67. "ng-recaptcha": "^5.0.0",
  68. "ng-starrating": "^1.0.11",
  69. "ng2-charts": "^1.1.1",
  70. "ng2-ckeditor": "1.1.9",
  71. "ng2-nouislider": "^1.7.13",
  72. "ng2-order-pipe": "^0.1.5",
  73. "ng2-pdf-viewer": "^5.0.1",
  74. "ng2-search-filter": "^0.4.7",
  75. "ng2-toastr": "^4.1.2",
  76. "ng2-tree": "^2.0.0-rc.11",
  77. "ngx-bootstrap": "^2.0.0-beta.9",
  78. "ngx-color-picker": "^4.5.3",
  79. "ngx-editor": "^1.2.1",
  80. "ngx-embed-video": "^1.0.4",
  81. "ngx-inactivity": "^1.0.1",
  82. "ngx-pagination": "^3.2.1",
  83. "ngx-stripe": "^6.0.0",
  84. "ngx-toastr": "^6.4.1-beta.0",
  85. "ngx-ui-switch": "^1.6.0",
  86. "npm": "^7.24.2",
  87. "primeng": "^4.3.0",
  88. "rxjs": "~7.5.0",
  89. "rxjs-compat": "6.2.2",
  90. "save": "^2.3.3",
  91. "socket.io-client": "^2.2.0",
  92. "sortablejs": "^1.8.4",
  93. "tslib": "^2.3.0",
  94. "underscore": "^1.13.1",
  95. "uuid": "^9.0.1",
  96. "zone.js": "~0.12.0"
  97. },
  98. "devDependencies": {
  99. "@angular-devkit/build-angular": "^15.0.5",
  100. "@angular/cli": "^15.2.10",
  101. "@angular/compiler-cli": "^15.0.0",
  102. "@angular/language-service": "^5.0.0",
  103. "@types/googlemaps": "^3.38.0",
  104. "@types/jasmine": "~4.3.0",
  105. "@types/jasminewd2": "^2.0.6",
  106. "@types/node": "^6.0.118",
  107. "@types/socket.io-client": "^1.4.32",
  108. "codelyzer": "~3.2.0",
  109. "jasmine-core": "~4.5.0",
  110. "jasmine-spec-reporter": "~4.1.0",
  111. "karma": "~6.4.0",
  112. "karma-chrome-launcher": "~3.1.0",
  113. "karma-cli": "~1.0.1",
  114. "karma-coverage": "~2.2.0",
  115. "karma-coverage-istanbul-reporter": "^1.2.1",
  116. "karma-jasmine": "~5.1.0",
  117. "karma-jasmine-html-reporter": "~2.0.0",
  118. "mi18n": "^0.3.4",
  119. "protractor": "^7.0.0",
  120. "ts-node": "~3.2.0",
  121. "tslint": "~5.7.0",
  122. "typescript": "~4.8.0"
  123. }
  124. }
  125. Here is angular.json file:
  126. {
  127. "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  128. "version": 1,
  129. "newProjectRoot": "projects",
  130. "projects": {
  131. "demo": {
  132. "projectType": "application",
  133. "schematics": {},
  134. "root": "",
  135. "sourceRoot": "src",
  136. "prefix": "app",
  137. "architect": {
  138. "build": {
  139. "builder": "@angular-devkit/build-angular:browser",
  140. "options": {
  141. "outputPath": "dist/demo",
  142. "index": "src/index.html",
  143. "main": "src/main.ts",
  144. "polyfills": [
  145. "zone.js"
  146. ],
  147. "tsConfig": "tsconfig.app.json",
  148. "assets": [
  149. "src/favicon.ico",
  150. "src/assets"
  151. ],
  152. "styles": [
  153. "src/styles.css",
  154. "node_modules/bootstrap-css-only/css/bootstrap.min.css",
  155. "node_modules/font-awesome/css/font-awesome.css",
  156. "node_modules/ionicons/css/ionicons.css",
  157. "node_modules/admin-lte-css/dist/css/AdminLTE.css",
  158. "node_modules/admin-lte-css/dist/css/skins/_all-skins.css",
  159. "src/assets/kendoui.css",
  160. "src/assets/sass/form-builder.scss",
  161. "src/assets/sass/form-render.scss",
  162. "node_modules/ng2-toastr/bundles/ng2-toastr.min.css",
  163. "node_modules/primeng/resources/primeng.min.css",
  164. "node_modules/primeng/resources/themes/omega/theme.css",
  165. "node_modules/ng2-tree/styles.css"
  166. ],
  167. "scripts": [
  168. "node_modules/jquery/dist/jquery.min.js",
  169. "node_modules/jquery-ui-sortable/jquery-ui.min.js",
  170. "node_modules/bootstrap/dist/js/bootstrap.min.js",
  171. "node_modules/moment/min/moment.min.js",
  172. "node_modules/chart.js/dist/Chart.js",
  173. "src/assets/dist/js/adminlte.js",
  174. "src/assets/hammerjs/hammer.js",
  175. "node_modules/jspdf/dist/jspdf.min.js",
  176. "node_modules/html2canvas/dist/html2canvas.min.js"
  177. ]
  178. },
  179. "configurations": {
  180. "production": {
  181. "budgets": [
  182. {
  183. "type": "initial",
  184. "maximumWarning": "500kb",
  185. "maximumError": "1mb"
  186. },
  187. {
  188. "type": "anyComponentStyle",
  189. "maximumWarning": "2kb",
  190. "maximumError": "4kb"
  191. }
  192. ],
  193. "outputHashing": "all"
  194. },
  195. "development": {
  196. "buildOptimizer": false,
  197. "optimization": false,
  198. "vendorChunk": true,
  199. "extractLicenses": false,
  200. "sourceMap": true,
  201. "namedChunks": true
  202. }
  203. },
  204. "defaultConfiguration": "production"
  205. },
  206. "serve": {
  207. "builder": "@angular-devkit/build-angular:dev-server",
  208. "configurations": {
  209. "production": {
  210. "browserTarget": "demo:build:production"
  211. },
  212. "development": {
  213. "browserTarget": "demo:build:development"
  214. }
  215. },
  216. "defaultConfiguration": "development"
  217. },
  218. "extract-i18n": {
  219. "builder": "@angular-devkit/build-angular:extract-i18n",
  220. "options": {
  221. "browserTarget": "demo:build"
  222. }
  223. },
  224. "test": {
  225. "builder": "@angular-devkit/build-angular:karma",
  226. "options": {
  227. "polyfills": [
  228. "zone.js",
  229. "zone.js/testing"
  230. ],
  231. "tsConfig": "tsconfig.spec.json",
  232. "assets": [
  233. "src/favicon.ico",
  234. "src/assets"
  235. ],
  236. "styles": [
  237. "src/styles.css"
  238. ],
  239. "scripts": []
  240. }
  241. }
  242. }
  243. }
  244. },
  245. "cli": {
  246. "analytics": "125d0ec8-f37c-4580-834c-591ee3bb8c6c"
  247. }
  248. }
  249. Here is tsconfig.json
  250. /* To learn more about this file see: https://angular.io/config/tsconfig. */
  251. {
  252. "compileOnSave": false,
  253. "compilerOptions": {
  254. "baseUrl": "./",
  255. "outDir": "./dist/out-tsc",
  256. "forceConsistentCasingInFileNames": true,
  257. "strict": true,
  258. "noImplicitOverride": true,
  259. "noPropertyAccessFromIndexSignature": true,
  260. "noImplicitReturns": true,
  261. "noFallthroughCasesInSwitch": true,
  262. "sourceMap": true,
  263. "declaration": false,
  264. "downlevelIteration": true,
  265. "experimentalDecorators": true,
  266. "moduleResolution": "node",
  267. "importHelpers": true,
  268. "target": "ES2022",
  269. "module": "ES2022",
  270. "useDefineForClassFields": false,
  271. "lib": [
  272. "ES2022",
  273. "dom"
  274. ]
  275. },
  276. "include": [
  277. "node_modules/angular2-json2csv/src/csv.service.ts",
  278. "node_modules/ngx-inactivity/src/app/ngx-inactivity/index.ts",
  279. "src/main.ts",
  280. "src/polyfills.ts",
  281. "src/*.ts",
  282. "src/app/**/*.ts"
  283. ],
  284. "angularCompilerOptions": {
  285. "enableI18nLegacyMessageIdFormat": false,
  286. "strictInjectionParameters": true,
  287. "strictInputAccessModifiers": true,
  288. "strictTemplates": true,
  289. "enableIvy": false
  290. }
  291. }
  292. Here is tsconfig-app.json:
  293. /* To learn more about this file see: https://angular.io/config/tsconfig. */
  294. {
  295. "extends": "./tsconfig.json",
  296. "compilerOptions": {
  297. "outDir": "./out-tsc/app",
  298. "types": []
  299. },
  300. "files": [
  301. "src/main.ts"
  302. ],
  303. "include": [
  304. "src/**/*.d.ts"
  305. ],
  306. "angularCompilerOptions": {
  307. "enableIvy": false
  308. }
  309. }
  310. Here is tsconfig-spec.json:
  311. /* To learn more about this file see: https://angular.io/config/tsconfig. */
  312. {
  313. "extends": "./tsconfig.json",
  314. "compilerOptions": {
  315. "outDir": "./out-tsc/spec",
  316. "types": [
  317. "jasmine"
  318. ]
  319. },
  320. "include": [
  321. "src/**/*.spec.ts",
  322. "src/**/*.d.ts"
  323. ]`enter code here`
  324. }
  325. Here need solution for this issue.Thanks in advance
cigdeys3

cigdeys31#

兄弟,我建议你做以下步骤,根据我的看法,你试图从angular版本5更新到angular版本15与ng更新,这可能不是一个可行的解决方案,所以尝试按照以下步骤
1.使用angular版本15创建新的angular应用程序
1.备份现有项目代码,但丢弃节点模块
1.现在替换src文件夹,在package.json中添加所有第三方依赖项,并在新创建的angular项目中从现有项目中添加angular.json中的脚本或样式
1.现在运行'npm i'
1.您可能会遇到一些第三方依赖项版本问题,然后尝试更新第三方依赖项,然后单击'npm i'
将angular 5保持到最新并不是一个好的做法,尝试一两年更新一次angular
我希望以上步骤能帮助你保持安全,快乐编码。

相关问题