Base solution for your next web application
Open Closed

TypeError: Cannot read property 'setDefault' of undefined #7934


User avatar
0
mujthabagroad created

Hello,

Facing an issue after setting Clock.Provider = ClockProviders.Utc;. Not able to load Angular and getting error as TypeError: Cannot read property 'setDefault' of undefined. But it is working fine when it is Clock.Provider = ClockProviders.Local.

Thanks.


15 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    What is your product version? Can you reproduce your problem in the latest Zero demo project.

  • User Avatar
    0
    mujthabagroad created

    Hi,

    There is no issue in demo project. Is there any other dependencies as our dev teams are working from different time zone.

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team

    Can you share your angular project source code?

    [email protected]

  • User Avatar
    0
    mujthabagroad created

    Can you check on remote, there are some limitations to share the code.

    Thanks for you support.

  • User Avatar
    0
    maliming created
    Support Team

    Did you install the following package?

        "moment": "^2.24.0",
        "moment-timezone": "^0.5.27",
    
  • User Avatar
    0
    mujthabagroad created

    I have this in my package.json. we are using version v7.2.2

    "moment": "^2.24.0", "moment-timezone": "^0.5.25",

  • User Avatar
    0
    maliming created
    Support Team

    Can you share the contents of your angular.json file?

  • User Avatar
    0
    mujthabagroad created

    {   "$schema": "./node_modules/@angular/cli/lib/config/schema.json",   "version": 1,   "newProjectRoot": "projects",   "projects": {     "abp-zero-template": {       "root": "",       "sourceRoot": "src",       "projectType": "application",       "architect": {         "build": {           "builder": "@angular-devkit/build-angular:browser",           "options": {             "outputPath": "dist",             "index": "src/index.html",             "main": "src/main.ts",             "tsConfig": "src/tsconfig.json",             "polyfills": "src/polyfills.ts",             "preserveSymlinks": true,             "assets": [               "src/assets",               "src/metronic",               "src/favicon.ico",               {                 "glob": "abp.signalr-client.js",                 "input": "node_modules/abp-web-resources/Abp/Framework/scripts/libs",                 "output": "/assets/abp"               }             ],             "styles": [               "node_modules/animate.css/animate.min.css",               "node_modules/quill/dist/quill.core.css",               "node_modules/quill/dist/quill.snow.css",               "node_modules/famfamfam-flags/dist/sprite/famfamfam-flags.css",               "node_modules/primeng/resources/primeng.min.css",               "node_modules/primeng/resources/themes/nova-light/theme.css",               "node_modules/primeicons/primeicons.css",               "node_modules/sweetalert2/dist/sweetalert2.css",               "node_modules/cookieconsent/build/cookieconsent.min.css",               "node_modules/@ng-select/ng-select/themes/default.theme.css",               "src/assets/FreezeUI/freeze-ui.min.css",

                  "src/assets/primeng/file-upload/css/primeng.file-upload.css",               "src/assets/primeng/autocomplete/css/primeng.autocomplete.css",               "src/assets/primeng/tree/css/primeng.tree.css",               "src/assets/primeng/context-menu/css/primeng.context-menu.css",

                  "src/assets/fonts/fonts-poppins.css",               "src/assets/fonts/fonts-roboto.css",

                  "src/assets/ngx-bootstrap/bs-datepicker.css",

                  "src/assets/metronic/vendors/global/vendors.bundle.css",

                  "src/app/shared/core.less",               "src/app/shared/layout/layout.less",               "src/styles.css",               //"node_modules/select2/dist/css/select2.min.css"               "node_modules/summernote/dist/summernote-lite.css"             ],             "scripts": [               "node_modules/@aspnet/signalr/dist/browser/signalr.min.js",               "node_modules/localforage/dist/localforage.js",               "node_modules/moment/min/moment-with-locales.js",               "node_modules/moment-timezone/builds/moment-timezone-with-data.js",               "node_modules/push.js/bin/push.js",               "node_modules/quill/dist/quill.js",               "node_modules/sweetalert2/dist/sweetalert2.js",               "node_modules/cookieconsent/build/cookieconsent.min.js",

                  "src/assets/FreezeUI/freeze-ui.js",

                  "src/assets/abp-web-resources/abp.js",               "src/assets/abp-web-resources/abp.sweet-alert.js",               "src/assets/abp-web-resources/abp.notify.js",               "src/assets/abp-web-resources/abp.freeze-ui.js",               "src/assets/canvas-toBlob/canvas-toBlob.js",               "node_modules/abp-web-resources/Abp/Framework/scripts/libs/abp.moment.js",

                  "src/assets/metronic/vendors/global/vendors.bundle.js",               "src/assets/metronic/common/js/scripts.bundle.js",               "node_modules/jquery/dist/jquery.min.js",               "node_modules/summernote/dist/summernote-lite.js",               "node_modules/@webcomponents/custom-elements/src/native-shim.js"               //"node_modules/select2/dist/js/select2.min.js"             ]           },           "configurations": {             "hmr": {               "fileReplacements": [                 {                   "replace": "src/environments/environment.ts",                   "with": "src/environments/environment.hmr.ts"                 }               ]             },             "production": {               "optimization": true,               "outputHashing": "all",               "sourceMap": false,               "extractCss": true,               "namedChunks": false,               "aot": true,               "extractLicenses": true,               "vendorChunk": false,               "buildOptimizer": true,               "fileReplacements": [                 {                   "replace": "src/environments/environment.ts",                   "with": "src/environments/environment.prod.ts"                 }               ]             }           }         },         "serve": {           "builder": "@angular-devkit/build-angular:dev-server",           "options": {             "browserTarget": "abp-zero-template:build"           },           "configurations": {             "hmr": {               "browserTarget": "abp-zero-template:build:hmr"             },             "production": {               "browserTarget": "abp-zero-template:build:production"             }           }         },         "extract-i18n": {           "builder": "@angular-devkit/build-angular:extract-i18n",           "options": {             "browserTarget": "abp-zero-template:build"           }         },         "test": {           "builder": "@angular-devkit/build-angular:karma",           "options": {             "tsConfig": "src/tsconfig.json",             "main": "src/test.ts",             "karmaConfig": "./karma.conf.js",             "polyfills": "src/polyfills.ts",             "styles": [               "node_modules/animate.css/animate.min.css",               "node_modules/quill/dist/quill.core.css",               "node_modules/quill/dist/quill.snow.css",               "node_modules/famfamfam-flags/dist/sprite/famfamfam-flags.css",               "node_modules/primeng/resources/primeng.min.css",               "node_modules/primeng/resources/themes/nova-light/theme.css",               "node_modules/primeicons/primeicons.css",               "node_modules/sweetalert2/dist/sweetalert2.css",               "node_modules/cookieconsent/build/cookieconsent.min.css",               "node_modules/@ng-select/ng-select/themes/default.theme.css",               "src/assets/FreezeUI/freeze-ui.min.css",

                  "src/assets/primeng/file-upload/css/primeng.file-upload.css",               "src/assets/primeng/autocomplete/css/primeng.autocomplete.css",               "src/assets/primeng/tree/css/primeng.tree.css",               "src/assets/primeng/context-menu/css/primeng.context-menu.css",

                  "src/assets/fonts/fonts-poppins.css",               "src/assets/fonts/fonts-roboto.css",

                  "src/assets/ngx-bootstrap/bs-datepicker.css",

                  "src/assets/metronic/vendors/global/vendors.bundle.css",

                  "src/app/shared/core.less",               "src/app/shared/layout/layout.less",               "src/styles.css",               //"node_modules/select2/dist/css/select2.min.css"               "node_modules/summernote/dist/summernote-lite.css"

                ],             "scripts": [               "node_modules/@aspnet/signalr/dist/browser/signalr.min.js",               "node_modules/localforage/dist/localforage.js",               "node_modules/moment/min/moment-with-locales.js",               "node_modules/moment-timezone/builds/moment-timezone-with-data.js",               "node_modules/push.js/bin/push.js",               "node_modules/quill/dist/quill.js",               "node_modules/sweetalert2/dist/sweetalert2.js",               "node_modules/cookieconsent/build/cookieconsent.min.js",               "src/assets/FreezeUI/freeze-ui.js",

                  "src/assets/abp-web-resources/abp.js",               "src/assets/abp-web-resources/abp.sweet-alert.js",               "src/assets/abp-web-resources/abp.notify.js",               "src/assets/abp-web-resources/abp.freeze-ui.js",               "src/assets/canvas-toBlob/canvas-toBlob.js",               "node_modules/abp-web-resources/Abp/Framework/scripts/libs/abp.moment.js",

                  "src/assets/metronic/vendors/global/vendors.bundle.js",               "src/assets/metronic/common/js/scripts.bundle.js",               "node_modules/jquery/dist/jquery.min.js",               "node_modules/summernote/dist/summernote-lite.js",               //"node_modules/select2/dist/js/select2.min.js"               "node_modules/@webcomponents/custom-elements/src/native-shim.js"             ],             "assets": [               "src/assets",               "src/favicon.ico",               {                 "glob": "abp.signalr-client.js",                 "input": "node_modules/abp-web-resources/Abp/Framework/scripts/libs",                 "output": "/assets/abp"               }             ]           }         },         "lint": {           "builder": "@angular-devkit/build-angular:tslint",           "options": {             "tsConfig": [               "src/tsconfig.json"             ],             "exclude": []           }         }       }     },     "abp-zero-template-e2e": {       "root": "",       "sourceRoot": "",       "projectType": "application",       "architect": {         "e2e": {           "builder": "@angular-devkit/build-angular:protractor",           "options": {             "protractorConfig": "./protractor.conf.js",             "devServerTarget": "abp-zero-template:serve",             "port": 4200           }         },         "lint": {           "builder": "@angular-devkit/build-angular:tslint",           "options": {             "tsConfig": [               "e2e/tsconfig.json"             ],             "exclude": []           }         }       }     }   },   "defaultProject": "abp-zero-template",   "schematics": {     "@schematics/angular:component": {       "prefix": "app",       "styleext": "css"     },     "@schematics/angular:directive": {       "prefix": "app"     }   } }

  • User Avatar
    0
    maliming created
    Support Team

    Please share your teamviewer connection information to [email protected]

  • User Avatar
    0
    mujthabagroad created

    Shared, please connect

  • User Avatar
    0
    maliming created
    Support Team

    hi mujthabagroad

    I suggest you share your project source code, just need angular code, you can remove the privacy code.

  • User Avatar
    0
    mujthabagroad created

    Hi maliming,

    I shared the code, please have a look.

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team

    hi mujthabagroad

    You can try to delete the node_modules directory and use yarn to restore the package. Or delete the package-lock.json file and use npm to restore the package.

  • User Avatar
    0
    mujthabagroad created

    Hi maliming,

    Thanks for your support, it worked,

    Should I upgrade "moment-timezone": "^0.5.25" to "^0.5.27" ?

  • User Avatar
    0
    maliming created
    Support Team

    You can upgrade all the packages you use if you need them. Please note that some versions may be a breaking change.

    I believe that the moment-timezone generally does not introduce breaking change.. You can try it out.