angular-cli: Cannot read property 'NoopAnalytics' of undefined

🐞 Bug report

Command (mark with an x)

- [x] new
- [x] build
- [x] serve
- [x] test
- [x] e2e
- [x] generate
- [x] add
- [x] update
- [x] lint
- [x] xi18n
- [x] run
- [x] config
- [x] help
- [x] version
- [x] doc

Is this a regression?

Yes, ng command stop working

Description

on run ng i’ve got:

Cannot read property 'NoopAnalytics' of undefined
TypeError: Cannot read property 'NoopAnalytics' of undefined
    at new Command (*/node_modules/@angular/cli/models/command.js:21:68)
    at new ArchitectCommand (*/node_modules/@angular/cli/models/architect-command.js:22:9)
    at new RunCommand (*/node_modules/@angular/cli/commands/run-impl.js:11:1)
    at Object.runCommand (*/node_modules/@angular/cli/models/command-runner.js:172:25)
    at async default_1 (*/node_modules/@angular/cli/lib/cli/index.js:32:31)

πŸ”¬ Minimal Reproduction

updated from 7 to 8

πŸ”₯ Exception or Error

Cannot read property 'NoopAnalytics' of undefined
TypeError: Cannot read property 'NoopAnalytics' of undefined
    at new Command (*/node_modules/@angular/cli/models/command.js:21:68)
    at new ArchitectCommand (*/node_modules/@angular/cli/models/architect-command.js:22:9)
    at new RunCommand (*/node_modules/@angular/cli/commands/run-impl.js:11:1)
    at Object.runCommand (*/node_modules/@angular/cli/models/command-runner.js:172:25)
    at async default_1 (*/node_modules/@angular/cli/lib/cli/index.js:32:31)



🌍 Your Environment

I can't ng don't work :), so here is my package.json:


  "dependencies": {
    "@nrwl/angular": "8.0.0",
    "@angular/animations": "^8.0.0",
    "@angular/common": "^8.0.0",
    "@angular/compiler": "^8.0.0",
    "@angular/core": "^8.0.0",
    "@angular/forms": "^8.0.0",
    "@angular/platform-browser": "^8.0.0",
    "@angular/platform-browser-dynamic": "^8.0.0",
    "@angular/router": "^8.0.0",
    "@angularclass/hmr": "^2.1.3",
    "@betadigitalproduction/ngx-platform-service": "^1.0.7",
    "@ngqp/core": "^1.0.0",
    "@ngrx/effects": "^7.4.0",
    "@ngrx/entity": "^7.4.0",
    "@ngrx/router-store": "^7.4.0",
    "@ngrx/schematics": "^7.4.0",
    "@ngrx/store": "^7.4.0",
    "@ngrx/store-devtools": "^7.4.0",
    "@ngx-pwa/local-storage": "8.0.0",
    "@ngx-translate/core": "11.0.1",
    "@sentry/browser": "5.3.0",
    "core-js": "^3.1.3",
    "date-fns": "^2.0.0-alpha.27",
    "localize-router": "2.0.0-RC.2",
    "ng-svg-icon-sprite": "1.6.0",
    "ng-zorro-antd": "^7.4.1",
    "ngx-build-plus": "8.0.0-rc.3.0.1",
    "nprogress": "^0.2.0",
    "rxjs": "6.5.2",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@nrwl/workspace": "8.0.0",
    "@nrwl/jest": "8.0.0",
    "@nrwl/cypress": "8.0.0",
    "@angular-devkit/build-angular": "~0.800.1",
    "@angular-devkit/build-ng-packagr": "~0.800.1",
    "@angular/cli": "8.0.1",
    "@angular/compiler-cli": "~8.0.0",
    "@angular/language-service": "^8.0.0",
    "@betalabs/ngx-observable-input": "^0.1.8",
    "@betalabs/ngx-take-until-destroy": "^0.1.9",
    "@biesbjerg/ngx-translate-extract": "2.3.4",
    "@ngrx/store-devtools": "7.4.0",
    "@types/jest": "24.0.13",
    "@types/jquery": "3.3.29",
    "@types/node": "~12.0.4",
    "@types/webpack": "^4.4.31",
    "codelyzer": "^5.0.1",
    "conventional-changelog-cli": "2.0.21",
    "cypress": "3.3.1",
    "cz-conventional-changelog": "2.1.0",
    "dotenv": "8.0.0",
    "jest": "24.8.0",
    "jest-preset-angular": "7.1.1",
    "junit": "^1.4.9",
    "mocha-junit-reporter": "^1.22.0",
    "ng-packagr": "^5.2.0",
    "ngrx-store-freeze": "0.2.4",
    "prettier": "1.17.1",
    "svg-sprite-generator": "0.0.7",
    "ts-jest": "24.0.2",
    "ts-node": "~8.2.0",
    "tsickle": ">=0.34.0",
    "tslib": "^1.9.0",
    "tslint": "~5.17.0",
    "typescript": "3.5.1"
  }

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 17 (6 by maintainers)

Most upvoted comments

πŸ€” I just got the same error, happening here. Looks like as if the imported analytics object is not defined which is really strange. When I generate a new v7 project and upgrade, the error doesn’t happen. Happens when I upgrade my nrwl/nx based project. Maybe NX changes that part of the upgrade process? @FrozenPandaz any insights here?

I have these devkit dependencies

"@angular-devkit/build-angular": "~0.13.1",
"@angular-devkit/build-ng-packagr": "^0.12.0",
"@angular-devkit/schematics": "^7.1.4",
"@angular/cli": "^7.3.7",
"@angular/compiler-cli": "^7.1.1",

// update
The error also happens when I start the app (after the failed upgrade, which looks like it completed). Removed @angular-devkit/schematics and the error disappears, getting #14557 now πŸ˜…. I’ll give it a closer look the next days

For us, it helped to remove the local node_modules prior to npm install.

I had success getting rid of this message by clearing my node modules folder and re-installing. exact steps I took were rm -rf node_modules then yarn to re-install the deps. yours obviously may be different because of packager etc.

hope that helps

@lorenjerickson @juristr @yishain11 @glebmachine can you confirm if matching versions between local & global CLI resolves the issue?

I met this issue also after I upgraded to v8. I debugged a little, seems the v8 cli invokes the @angular-devkit/core@7, then it cannot find the NoopAnalytics, so I reinstalled the @angular-devkit/core again, then this error was gone.

Can you check what version the globally installed @angular/cli is on your system?