webpack Angular 7构建失败

2nc8po8w  于 2024-01-08  发布在  Webpack
关注(0)|答案(1)|浏览(163)

Angular 7,npm 5.5.1 node 8.9.0

终端

  1. npm run build:test
  2. [email protected] build:test C:\Projects\fff
  3. ng build --aot --build-optimizer --output-hashing=all
  4. 11% building modules 10/17 modules 7 active ...fff\src\lib\css\component.cssBrowserslist: caniuse-lite is outdated. Please run next command `npm update`
  5. 92% after chunk asset optimization SourceMapDevToolPlugin vendor.252af5e4ca571811ec29.js generate SourceMap

字符串

最后几个GC

  1. [11300:000002C0DD75A2C0] 164886 ms: Mark-sweep 1412.1 (1557.3) -> 1412.1 (1519.3) MB, 673.1 / 0.0 ms last resort GC in old space requested
  2. [11300:000002C0DD75A2C0] 165582 ms: Mark-sweep 1412.1 (1519.3) -> 1412.1 (1511.3) MB, 696.0 / 0.0 ms last resort GC in old space requested

JS stacktrace

  1. ==== JS stack trace =========================================
  2. Security context: 0000000EC2725EC1 <JSObject>
  3. 1: /* anonymous */ [C:\Projects\fff\node_modules\webpack-sources\node_modules\source-map\lib\source-node.js:~342] [pc=00000111AF908CFC](this=000001C78768BE21 <JSGlobal Object>,chunk=000002CFC1F07C09 <String[4]\: /**\n>,original=0000020414F69E59 <Object map = 000001F7B5060559>)
  4. 2: SourceNode_walk [C:\Projects\fff...
  5. FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
  6. npm ERR! code ELIFECYCLE
  7. npm ERR! errno 3
  8. npm ERR! [email protected] build:test: `ng build --aot --build-optimizer --output-hashing=all`
  9. npm ERR! Exit status 3
  10. npm ERR!
  11. npm ERR! Failed at the [email protected] build:test script.
  12. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  13. npm ERR! A complete log of this run can be found in:
  14. npm ERR! C:\Users\fff\AppData\Roaming\npm-cache\_logs\2023-11-30T20_35_32_692Z-debug.log

日志文件

  1. 0 info it worked if it ends with ok
  2. 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
  3. 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
  4. 1 verbose cli 'run',
  5. 1 verbose cli 'build:test' ]
  6. 2 info using [email protected]
  7. 3 info using [email protected]
  8. 4 verbose run-script [ 'prebuild:test', 'build:test', 'postbuild:test' ]
  9. 5 info lifecycle [email protected]~prebuild:test: [email protected]
  10. 6 info lifecycle [email protected]~build:test: [email protected]
  11. 7 verbose lifecycle [email protected]~build:test: unsafe-perm in lifecycle true
  12. 8 verbose lifecycle [email protected]~build:test: PATH: C:\Users\Salamandra\AppData\Roaming\nvm\v8.9.0\node_modules\npm\bin\node-gyp-bin;C:\Projects\fff\node_modules\.bin;C:\Users\fff\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\fff\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python27;C:\Python27\Scripts;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.2.0;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\fff\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\PowerShell\7;C:\Users\Salamandra\AppData\Local\Programs\Python\Python310\Scripts;C:\Users\Salamandra\AppData\Local\Programs\Python\Python310;C:\Users\Salamandra\anaconda3;C:\Users\Salamandra\anaconda3\Library\mingw-w64\bin;C:\Users\fff\anaconda3\Library\usr\bin;C:\Users\fff\anaconda3\Library\bin;C:\Users\fff\anaconda3\Scripts;C:\Users\fff\AppData\Local\Microsoft\WindowsApps;C:\Users\fff\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\fff\AppData\Roaming\npm;C:\Users\fff\AppData\Local\GitHubDesktop\bin;C:\Users\fff\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\fff\.dotnet\tools;C:\Program Files (x86)\Nmap;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
  13. 9 verbose lifecycle [email protected]~build:test: CWD: C:\Projects\SoldOut\gitlab_soldout_front\soldout_front
  14. 10 silly lifecycle [email protected]~build:test: Args: [ '/d /s /c',
  15. 10 silly lifecycle 'ng build --aot --build-optimizer --output-hashing=all' ]
  16. 11 silly lifecycle [email protected]~build:test: Returned: code: 3 signal: null
  17. 12 info lifecycle [email protected]~build:test: Failed to exec build:test script
  18. 13 verbose stack Error: [email protected] build:test: `ng build --aot --build-optimizer --output-hashing=all`
  19. 13 verbose stack Exit status 3
  20. 13 verbose stack at EventEmitter.<anonymous> (C:\Users\fff\AppData\Roaming\nvm\v8.9.0\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
  21. 13 verbose stack at emitTwo (events.js:126:13)
  22. 13 verbose stack at EventEmitter.emit (events.js:214:7)
  23. 13 verbose stack at ChildProcess.<anonymous> (C:\Users\fff\AppData\Roaming\nvm\v8.9.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
  24. 13 verbose stack at emitTwo (events.js:126:13)
  25. 13 verbose stack at ChildProcess.emit (events.js:214:7)
  26. 13 verbose stack at maybeClose (internal/child_process.js:925:16)
  27. 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  28. 14 verbose pkgid [email protected]
  29. 15 verbose cwd C:\Projects\fff
  30. 16 verbose Windows_NT 10.0.22631
  31. 17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build:test"
  32. 18 verbose node v8.9.0
  33. 19 verbose npm v5.5.1
  34. 20 error code ELIFECYCLE
  35. 21 error errno 3
  36. 22 error [email protected] build:test: `ng build --aot --build-optimizer --output-hashing=all`
  37. 22 error Exit status 3
  38. 23 error Failed at the [email protected] build:test script.
  39. 23 error This is probably not a problem with npm. There is likely additional logging output above.
  40. 24 verbose exit [ 3, true ]


angular.json

  1. "build": {
  2. "builder": "@angular-devkit/build-angular:browser",
  3. "options": {
  4. "outputPath": "dist/browser",
  5. "index": "src/index.html",
  6. "main": "src/main.ts",
  7. "polyfills": "src/polyfills.ts",
  8. "tsConfig": "src/tsconfig.app.json",
  9. "assets": [
  10. {
  11. "glob": "**/*",
  12. "input": "node_modules/leaflet/dist/images",
  13. "output": "leaflet/"
  14. },
  15. "src/favicon.ico",
  16. "src/assets",
  17. "src/robots.txt",
  18. "src/sp-push-worker-fb.js"
  19. ],
  20. "styles": [
  21. "node_modules/slick-carousel/slick/slick.scss",
  22. "node_modules/snazzy-info-window/dist/snazzy-info-window.css",
  23. "src/scss/styles.scss",
  24. "node_modules/leaflet/dist/leaflet.css",
  25. "src/lib/css/component.css",
  26. "node_modules/swiper/css/swiper.css",
  27. "node_modules/aos/dist/aos.css"
  28. ],
  29. "scripts": [
  30. "node_modules/jquery/dist/jquery.min.js",
  31. "node_modules/slick-carousel/slick/slick.min.js",
  32. "node_modules/bootstrap/dist/js/bootstrap.js",
  33. "src/lib/js/modernizr.custom.js",
  34. "src/lib/js/jquery.dlmenu.js",
  35. "node_modules/swiper/js/swiper.min.js"
  36. ]
  37. },
  38. "configurations": {
  39. "production": {
  40. "fileReplacements": [
  41. {
  42. "replace": "src/environments/environment.ts",
  43. "with": "src/environments/environment.prod.ts"
  44. },
  45. {
  46. "replace": "src/index.html",
  47. "with": "src/index.prod.html"
  48. }
  49. ],
  50. "optimization": true,
  51. "outputHashing": "all",
  52. "sourceMap": false,
  53. "extractCss": true,
  54. "namedChunks": false,
  55. "aot": true,
  56. "extractLicenses": true,
  57. "vendorChunk": false,
  58. "buildOptimizer": true,
  59. "budgets": [
  60. {
  61. "type": "initial",
  62. "maximumWarning": "2mb",
  63. "maximumError": "5mb"
  64. }
  65. ]
  66. }
  67. }

deps

  1. "private": true,
  2. "dependencies": {
  3. "@agm/core": "^1.0.0-beta.5",
  4. "@agm/snazzy-info-window": "^1.0.0-beta.5",
  5. "@angular/animations": "^7.0.4",
  6. "@angular/cdk": "~7.3.7",
  7. "@angular/common": "~7.0.0",
  8. "@angular/compiler": "~7.0.0",
  9. "@angular/core": "~7.0.0",
  10. "@angular/forms": "~7.0.0",
  11. "@angular/http": "~7.0.0",
  12. "@angular/material": "~7.3.7",
  13. "@angular/platform-browser": "~7.0.0",
  14. "@angular/platform-browser-dynamic": "~7.0.0",
  15. "@angular/platform-server": "~7.0.0",
  16. "@angular/router": "~7.0.0",
  17. "@asymmetrik/ngx-leaflet": "^5.0.2",
  18. "@biesbjerg/ngx-translate-extract": "^2.3.4",
  19. "@ngrx/effects": "^7.4.0",
  20. "@ngrx/store": "^7.4.0",
  21. "@ngrx/store-devtools": "^7.4.0",
  22. "@nguniversal/common": "^8.2.6",
  23. "@nguniversal/express-engine": "^7.1.1",
  24. "@nguniversal/module-map-ngfactory-loader": "0.0.0",
  25. "@ngx-translate/core": "^11.0.1",
  26. "@ngx-translate/http-loader": "^4.0.0",
  27. "@types/google.accounts": "^0.0.14",
  28. "@types/leaflet": "^1.5.2",
  29. "@types/moment": "^2.13.0",
  30. "angular2-multiselect-dropdown": "^4.6.3",
  31. "angular2-text-mask": "^9.0.0",
  32. "aos": "^3.0.0-beta.6",
  33. "bootstrap": "^4.3.1",
  34. "core-js": "^2.5.4",
  35. "express": "^4.15.2",
  36. "hammerjs": "^2.0.8",
  37. "jquery": "^3.4.0",
  38. "leaflet": "^1.5.1",
  39. "localstorage-polyfill": "^1.0.1",
  40. "moment": "^2.24.0",
  41. "net": "^1.0.2",
  42. "ngx-barcode": "^0.2.4",
  43. "ngx-image-cropper": "^1.3.9",
  44. "ngx-pinch-zoom": "^1.2.5",
  45. "ngx-plyr": "^1.1.1",
  46. "ngx-slick-carousel": "^0.4.4",
  47. "node-sass": "^4.13.1",
  48. "panzoom": "^9.2.1",
  49. "plyr": "^3.4.7",
  50. "rxjs": "~6.3.3",
  51. "saturn-datepicker": "7.3.0",
  52. "sitemap-generator-cli": "^4.3.0",
  53. "slick-carousel": "^1.8.1",
  54. "snazzy-info-window": "^1.1.1",
  55. "sockjs-client": "^1.3.0",
  56. "stompjs": "^2.3.3",
  57. "svg-pan-zoom": "github:ariutta/svg-pan-zoom",
  58. "swiper": "^5.2.1",
  59. "zone.js": "~0.8.26"
  60. },
  61. "devDependencies": {
  62. "@angular-devkit/build-angular": "~0.10.0",
  63. "@angular/cli": "~7.0.3",
  64. "@angular/compiler-cli": "~7.0.0",
  65. "@angular/language-service": "~7.0.0",
  66. "@types/jasmine": "~2.8.8",
  67. "@types/jasminewd2": "~2.0.3",
  68. "@types/node": "~8.9.4",
  69. "codelyzer": "~4.5.0",
  70. "custom-cursor.js": "^1.0.6",
  71. "husky": "^1.3.1",
  72. "jasmine-core": "~2.99.1",
  73. "jasmine-spec-reporter": "~4.2.1",
  74. "karma": "~3.0.0",
  75. "karma-chrome-launcher": "~2.2.0",
  76. "karma-coverage-istanbul-reporter": "~2.0.1",
  77. "karma-jasmine": "~1.1.2",
  78. "karma-jasmine-html-reporter": "^0.2.2",
  79. "ngrx-store-freeze": "^0.2.4",
  80. "protractor": "~5.4.0",
  81. "ts-loader": "^5.2.0",
  82. "ts-node": "~7.0.0",
  83. "tslint": "~5.11.0",
  84. "tslint-eslint-rules": "^5.4.0",
  85. "typescript": "~3.1.1",
  86. "webpack-cli": "^3.1.0"
  87. }
  88. }


node --max_old_space_size=4096不工作,--prod正在工作

m0rkklqb

m0rkklqb1#

增加内存并运行构建。

  1. node --max-old-space-size=16000 npm run build:test

字符串

相关问题