webpack Angular 7构建失败

2nc8po8w  于 11个月前  发布在  Webpack
关注(0)|答案(1)|浏览(139)

Angular 7,npm 5.5.1 node 8.9.0

终端

npm run build:test

[email protected] build:test C:\Projects\fff
ng build  --aot --build-optimizer --output-hashing=all

11% building modules 10/17 modules 7 active ...fff\src\lib\css\component.cssBrowserslist: caniuse-lite is outdated. Please run next command `npm update`
92% after chunk asset optimization SourceMapDevToolPlugin vendor.252af5e4ca571811ec29.js generate SourceMap

字符串

最后几个GC

[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
[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

==== JS stack trace =========================================

Security context: 0000000EC2725EC1 <JSObject>
    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>)
    2: SourceNode_walk [C:\Projects\fff...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! [email protected] build:test: `ng build  --aot --build-optimizer --output-hashing=all`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the [email protected] build:test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\fff\AppData\Roaming\npm-cache\_logs\2023-11-30T20_35_32_692Z-debug.log

日志文件

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build:test' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild:test', 'build:test', 'postbuild:test' ]
5 info lifecycle [email protected]~prebuild:test: [email protected]
6 info lifecycle [email protected]~build:test: [email protected]
7 verbose lifecycle [email protected]~build:test: unsafe-perm in lifecycle true
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
9 verbose lifecycle [email protected]~build:test: CWD: C:\Projects\SoldOut\gitlab_soldout_front\soldout_front
10 silly lifecycle [email protected]~build:test: Args: [ '/d /s /c',
10 silly lifecycle   'ng build  --aot --build-optimizer --output-hashing=all' ]
11 silly lifecycle [email protected]~build:test: Returned: code: 3  signal: null
12 info lifecycle [email protected]~build:test: Failed to exec build:test script
13 verbose stack Error: [email protected] build:test: `ng build  --aot --build-optimizer --output-hashing=all`
13 verbose stack Exit status 3
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)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
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)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Projects\fff
16 verbose Windows_NT 10.0.22631
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build:test"
18 verbose node v8.9.0
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 3
22 error [email protected] build:test: `ng build  --aot --build-optimizer --output-hashing=all`
22 error Exit status 3
23 error Failed at the [email protected] build:test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3, true ]


angular.json

"build": {
              "builder": "@angular-devkit/build-angular:browser",
              "options": {
                "outputPath": "dist/browser",
                "index": "src/index.html",
                "main": "src/main.ts",
                "polyfills": "src/polyfills.ts",
                "tsConfig": "src/tsconfig.app.json",
                "assets": [
                  {
                    "glob": "**/*",
                    "input": "node_modules/leaflet/dist/images",
                    "output": "leaflet/"
                  },
                  "src/favicon.ico",
                  "src/assets",
                  "src/robots.txt",
                  "src/sp-push-worker-fb.js"
                ],
                "styles": [
                  "node_modules/slick-carousel/slick/slick.scss",
                  "node_modules/snazzy-info-window/dist/snazzy-info-window.css",
                  "src/scss/styles.scss",
                  "node_modules/leaflet/dist/leaflet.css",
                  "src/lib/css/component.css",
                  "node_modules/swiper/css/swiper.css",
                  "node_modules/aos/dist/aos.css"
                ],
                "scripts": [
                  "node_modules/jquery/dist/jquery.min.js",
                  "node_modules/slick-carousel/slick/slick.min.js",
                  "node_modules/bootstrap/dist/js/bootstrap.js",
                  "src/lib/js/modernizr.custom.js",
                  "src/lib/js/jquery.dlmenu.js",
                  "node_modules/swiper/js/swiper.min.js"
                ]
              },
              "configurations": {
                "production": {
                  "fileReplacements": [
                    {
                      "replace": "src/environments/environment.ts",
                      "with": "src/environments/environment.prod.ts"
                    },
                    {
                  "replace": "src/index.html",
                      "with": "src/index.prod.html"
                    }
                  ],
                  "optimization": true,
                  "outputHashing": "all",
                  "sourceMap": false,
                  "extractCss": true,
                  "namedChunks": false,
                  "aot": true,
                  "extractLicenses": true,
                  "vendorChunk": false,
                  "buildOptimizer": true,
                  "budgets": [
                    {
                      "type": "initial",
                      "maximumWarning": "2mb",
                      "maximumError": "5mb"
                    }
                  ]
                }
              }

deps

"private": true,
      "dependencies": {
        "@agm/core": "^1.0.0-beta.5",
        "@agm/snazzy-info-window": "^1.0.0-beta.5",
        "@angular/animations": "^7.0.4",
        "@angular/cdk": "~7.3.7",
        "@angular/common": "~7.0.0",
        "@angular/compiler": "~7.0.0",
        "@angular/core": "~7.0.0",
        "@angular/forms": "~7.0.0",
        "@angular/http": "~7.0.0",
        "@angular/material": "~7.3.7",
        "@angular/platform-browser": "~7.0.0",
        "@angular/platform-browser-dynamic": "~7.0.0",
        "@angular/platform-server": "~7.0.0",
        "@angular/router": "~7.0.0",
        "@asymmetrik/ngx-leaflet": "^5.0.2",
        "@biesbjerg/ngx-translate-extract": "^2.3.4",
        "@ngrx/effects": "^7.4.0",
        "@ngrx/store": "^7.4.0",
        "@ngrx/store-devtools": "^7.4.0",
        "@nguniversal/common": "^8.2.6",
        "@nguniversal/express-engine": "^7.1.1",
        "@nguniversal/module-map-ngfactory-loader": "0.0.0",
        "@ngx-translate/core": "^11.0.1",
        "@ngx-translate/http-loader": "^4.0.0",
        "@types/google.accounts": "^0.0.14",
        "@types/leaflet": "^1.5.2",
        "@types/moment": "^2.13.0",
        "angular2-multiselect-dropdown": "^4.6.3",
        "angular2-text-mask": "^9.0.0",
        "aos": "^3.0.0-beta.6",
        "bootstrap": "^4.3.1",
        "core-js": "^2.5.4",
        "express": "^4.15.2",
        "hammerjs": "^2.0.8",
        "jquery": "^3.4.0",
        "leaflet": "^1.5.1",
        "localstorage-polyfill": "^1.0.1",
        "moment": "^2.24.0",
        "net": "^1.0.2",
        "ngx-barcode": "^0.2.4",
        "ngx-image-cropper": "^1.3.9",
        "ngx-pinch-zoom": "^1.2.5",
        "ngx-plyr": "^1.1.1",
        "ngx-slick-carousel": "^0.4.4",
        "node-sass": "^4.13.1",
        "panzoom": "^9.2.1",
        "plyr": "^3.4.7",
        "rxjs": "~6.3.3",
        "saturn-datepicker": "7.3.0",
        "sitemap-generator-cli": "^4.3.0",
        "slick-carousel": "^1.8.1",
        "snazzy-info-window": "^1.1.1",
        "sockjs-client": "^1.3.0",
        "stompjs": "^2.3.3",
        "svg-pan-zoom": "github:ariutta/svg-pan-zoom",
        "swiper": "^5.2.1",
        "zone.js": "~0.8.26"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "~0.10.0",
        "@angular/cli": "~7.0.3",
        "@angular/compiler-cli": "~7.0.0",
        "@angular/language-service": "~7.0.0",
        "@types/jasmine": "~2.8.8",
        "@types/jasminewd2": "~2.0.3",
        "@types/node": "~8.9.4",
        "codelyzer": "~4.5.0",
        "custom-cursor.js": "^1.0.6",
        "husky": "^1.3.1",
        "jasmine-core": "~2.99.1",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~3.0.0",
        "karma-chrome-launcher": "~2.2.0",
        "karma-coverage-istanbul-reporter": "~2.0.1",
        "karma-jasmine": "~1.1.2",
        "karma-jasmine-html-reporter": "^0.2.2",
        "ngrx-store-freeze": "^0.2.4",
        "protractor": "~5.4.0",
        "ts-loader": "^5.2.0",
        "ts-node": "~7.0.0",
        "tslint": "~5.11.0",
        "tslint-eslint-rules": "^5.4.0",
        "typescript": "~3.1.1",
        "webpack-cli": "^3.1.0"
      }
    }


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

m0rkklqb

m0rkklqb1#

增加内存并运行构建。

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

字符串

相关问题