Base solution for your next web application
Open Closed

Angular Project Publish Error at 92% #11326


User avatar
0
fawad29 created

Angular Project

  • "name": "abp-zero-template",

  • "version": "10.0.0",

  • "abp-ng2-module": "^6.2.0",

  • "abp-web-resources": "^5.3.0",

  • Nebula Core version 10.0.0.

  • Abp (6.0.0)

I am getting below error when I run npm run publish command.

The error always appears at 92% when it is processing Terser.

ERROR in scripts.ef3fafcd5c3608cf8cf5.js from Terser
Invalid assignment [scripts.ef3fafcd5c3608cf8cf5.js:22301,33]
    at ee (C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:19541)
    at c (C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:28244)
    at ze (C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:50572)
    at qe (C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:50653)
    at T (C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:34140)
    at C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:30509
    at C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:28976
    at N (C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:38503)
    at C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:30588
    at C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\terser\dist\bundle.min.js:1:28976

Full screenshot of the error is given below.

The Error log shows below detail.

0 info it worked if it ends with ok
1 verbose cli [
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   'publish'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prepublish', 'publish', 'postpublish' ]
5 info lifecycle [email protected]~prepublish: [email protected]
6 info lifecycle [email protected]~publish: [email protected]
7 verbose lifecycle [email protected]~publish: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~publish: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\graphite.rack\source\repos\NebulaAngular\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\dotnet\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\nodejs\;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Users\graphite.rack\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Azure Data Studio\bin;C:\Users\graphite.rack\.dotnet\tools;C:\Users\graphite.rack\AppData\Local\Yarn\bin;C:\Users\graphite.rack\AppData\Roaming\npm;
9 verbose lifecycle [email protected]~publish: CWD: C:\Users\graphite.rack\source\repos\NebulaAngular
10 silly lifecycle [email protected]~publish: Args: [
10 silly lifecycle   '/d /s /c',
10 silly lifecycle   'gulp build && node --max_old_space_size=40240 ./node_modules/@angular/cli/bin/ng build --prod'
10 silly lifecycle ]
11 silly lifecycle [email protected]~publish: Returned: code: 1  signal: null
12 info lifecycle [email protected]~publish: Failed to exec publish script
13 verbose stack Error: [email protected] publish: `gulp build && node --max_old_space_size=40240 ./node_modules/@angular/cli/bin/ng build --prod`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\graphite.rack\source\repos\NebulaAngular
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "publish"
18 verbose node v14.16.0
19 verbose npm  v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] publish: `gulp build && node --max_old_space_size=40240 ./node_modules/@angular/cli/bin/ng build --prod`
22 error Exit status 1
23 error Failed at the [email protected] publish script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]


My Package.json file is shown below.

{
  "name": "abp-zero-template",
  "version": "10.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "ng-high-memory": "node --max_old_space_size=40240 ./node_modules/@angular/cli/bin/ng",
    "publish": "gulp build && node --max_old_space_size=40240 ./node_modules/@angular/cli/bin/ng build --prod",
    "start": "gulp buildDev && ng serve --host 0.0.0.0 --port 4201",
    "hmr": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --host 0.0.0.0 --port 4201 --hmr",
    "test": "gulp buildDev && ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "gulp buildDev && protractor",
    "create-dynamic-bundles": "gulp buildDev",
    "nswag": "cd nswag/ && refresh.bat"
  },
  "private": false,
  "dependencies": {
    "@angular/animations": "^10.0.2",
    "@angular/cdk": "^10.0.1",
    "@angular/common": "^10.0.2",
    "@angular/compiler": "^10.0.2",
    "@angular/core": "^10.0.2",
    "@angular/elements": "^11.0.3",
    "@angular/forms": "^10.0.2",
    "@angular/localize": "^11.0.3",
    "@angular/platform-browser": "^10.0.2",
    "@angular/platform-browser-dynamic": "^10.0.2",
    "@angular/platform-server": "^10.0.2",
    "@angular/router": "^10.0.2",
    "@formio/angular": "5.2.3-rc.1",
    "@fullcalendar/core": "^5.1.0",
    "@microsoft/signalr": "^3.1.3",
    "@progress/kendo-angular-buttons": "6.1.0",
    "@progress/kendo-angular-charts": "^5.1.0",
    "@progress/kendo-angular-common": "2.0.0",
    "@progress/kendo-angular-dateinputs": "5.1.0",
    "@progress/kendo-angular-dialog": "^5.0.0",
    "@progress/kendo-angular-dropdowns": "5.1.0",
    "@progress/kendo-angular-excel-export": "4.0.0",
    "@progress/kendo-angular-grid": "5.0.1",
    "@progress/kendo-angular-icons": "^0.4.3",
    "@progress/kendo-angular-inputs": "7.1.0",
    "@progress/kendo-angular-intl": "3.1.0",
    "@progress/kendo-angular-l10n": "3.0.0",
    "@progress/kendo-angular-label": "^3.0.0",
    "@progress/kendo-angular-layout": "^6.1.5",
    "@progress/kendo-angular-navigation": "^1.1.0",
    "@progress/kendo-angular-pdf-export": "3.0.0",
    "@progress/kendo-angular-popup": "4.0.0",
    "@progress/kendo-angular-progressbar": "^2.0.1",
    "@progress/kendo-angular-scheduler": "^2.1.1",
    "@progress/kendo-angular-treeview": "^5.1.0",
    "@progress/kendo-data-query": "1.5.4",
    "@progress/kendo-date-math": "^1.5.3",
    "@progress/kendo-drawing": "1.13.7",
    "@progress/kendo-licensing": "^1.1.3",
    "@progress/kendo-recurrence": "^1.0.1",
    "@progress/kendo-svg-icons": "^0.1.2",
    "@progress/kendo-theme-default": "4.32.0",
    "@swimlane/ngx-charts": "^16.0.0",
    "abp-ng2-module": "^6.2.0",
    "abp-web-resources": "^5.3.0",
    "adal-angular": "^1.0.17",
    "add": "^2.0.6",
    "angular-gridster2": "^10.0.1",
    "angular-http-deserializer": "^1.0.13",
    "angular-oauth2-oidc": "^10.0.2",
    "angular2-counto": "^1.2.5",
    "angular2-text-mask": "^9.0.0",
    "animate.css": "^4.1.0",
    "chart.js": "^2.9.3",
    "cookieconsent": "^3.1.1",
    "core-js": "^3.6.4",
    "famfamfam-flags": "^1.0.0",
    "flatpickr": "^4.6.9",
    "formiojs": "4.15.0-rc.13",
    "js-cookie": "^2.2.1",
    "just-compare": "^1.3.0",
    "localforage": "^1.7.3",
    "lodash-es": "^4.17.0",
    "luxon": "^1.25.0",
    "msal": "^1.2.2",
    "ng2-file-upload": "^1.4.0",
    "ngx-bootstrap": "^5.6.1",
    "ngx-captcha": "^8.0.1",
    "ngx-doc-viewer2": "^1.5.3",
    "ngx-image-cropper": "^3.1.4",
    "ngx-perfect-scrollbar": "^9.0.0",
    "ngx-spinner": "^9.0.1",
    "object-path": "^0.11.4",
    "primeicons": "^4.0.0",
    "primeng": "^9.1.2",
    "push.js": "^1.0.12",
    "quill": "^1.3.7",
    "rtl-detect": "^1.0.2",
    "rxjs": "^6.5.4",
    "simple-line-icons": "^2.4.1",
    "splitter": "^0.1.2",
    "sweetalert2": "^9.10.7",
    "text-mask-addons": "^3.8.0",
    "tslib": "^2.0.0",
    "webdriver-manager": "^12.1.7",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1000.0",
    "@angular/cli": "^10.0.0",
    "@angular/compiler-cli": "^10.0.2",
    "@angularclass/hmr": "^2.1.3",
    "@angularclass/hmr-loader": "^3.0.4",
    "@types/jasmine": "~3.5.10",
    "@types/jasminewd2": "^2.0.8",
    "@types/lodash-es": "^4.17.0",
    "@types/luxon": "^1.25.0",
    "@types/node": "^14.0.14",
    "codelyzer": "^6.0.0",
    "globby": "^11.0.1",
    "gulp": "^4.0.1",
    "gulp-clean-css": "^4.3.0",
    "gulp-concat": "^2.6.1",
    "gulp-less": "^4.0.1",
    "gulp-postcss": "^8.0.0",
    "gulp-uglify": "^3.0.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.1.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-cli": "~2.0.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "merge-stream": "^2.0.0",
    "nswag": "^13.7.4",
    "postcss-url": "^9.0.0",
    "prettier": "2.1.2",
    "protractor": "~7.0.0",
    "ts-node": "~8.10.2",
    "tslint": "~6.1.0",
    "tslint-config-prettier": "^1.18.0",
    "typescript": "3.9.6"
  },
  "config": {
    "max_old_space_size": 40240
  }
}

I have tried below changes but of no use.

  • Set fullTemplateTypeCheck and strictTemplates to false in tsconfig.json.
   "angularCompilerOptions": {
    **"fullTemplateTypeCheck": false,**
    **"strictTemplates": false,**
    "strictInputTypes": false,
    "strictAttributeTypes": false,
    "strictOutputEventTypes": false,
    "strictDomEventTypes": false,
    "strictLiteralTypes": false,
    "strictInjectionParameters": false
  }
  • Set buildOptimizer to false in Angular.json file.
"production": {
              "budgets": [
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": false,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
  • Tried both commands shown below.
npm run publish
npm run ng-high-memory --build --prod

  • Increased memory to 40240.

Can someone please help, it is preventing us publish the app?

Thank you


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @learner29

    Could you first run gulp build and see if it succeeds ?

  • User Avatar
    0
    fawad29 created

    Hi @ismcagdas,

    Yes gulp build works fine. Please see below different variations that I tried.

    I have received the same error when I ran npm run publish.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Is it possible to share your Angular project via email with [email protected] ?

    Thanks,

  • User Avatar
    0
    fawad29 created

    Hi,

    Project sent yesterday via email link.

    Thanks Fawad

  • User Avatar
    0
    admin created

    Hi,

    Could you replace the util.js in your project with this one https://github.com/aspnetzero/aspnet-zero-core/blob/rel-10.0/angular/src/assets/metronic/common/js/components/util.js and see if it fixes the problem ?

  • User Avatar
    0
    fawad29 created

    Replacing the util.js has fixed the problem.

    Thanks for your help.