Angular-cli: Cannot read property 'Private' of undefined

Created on 4 Mar 2017  ยท  3Comments  ยท  Source: angular/angular-cli

OS?

Linux Debian 8

Versions.

ng -v
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / โ–ณ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0-rc.1
node: 7.4.0
os: linux x64
@angular/animations: 4.0.0-rc.2
@angular/common: 4.0.0-rc.2
@angular/compiler: 4.0.0-rc.2
@angular/compiler-cli: 4.0.0-rc.2
@angular/core: 4.0.0-rc.2
@angular/forms: 4.0.0-rc.2
@angular/http: 4.0.0-rc.2
@angular/platform-browser: 4.0.0-rc.2
@angular/platform-browser-dynamic: 4.0.0-rc.2
@angular/platform-server: 4.0.0-rc.2
@angular/router: 4.0.0-rc.2
@angular/cli: 1.0.0-rc.1x

tsc -v
Version 2.2.1

Repro steps.

I updated Angular using the official command:

npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save

Then angular-cli:

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
rm -rf node_modules dist
npm install --save-dev @angular/cli@latest
npm install

I also updated TypeScript (I read it could be the solution):
sudo npm -g upgrade typescript

Then npm:
sudo npm install npm@latest -g

The log given by the failure.

With this command:
npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save
I get the Unmeet peer dependency warning even if my TypeScript is updated:

โ”œโ”€โ”€ @angular/[email protected] 
โ”œโ”€โ”€ @angular/[email protected] 
โ”œโ”€โ”€ @angular/[email protected] 
โ”œโ”€โ”ฌ @angular/[email protected]  invalid
โ”‚ โ””โ”€โ”€ UNMET PEER DEPENDENCY typescript@^2.1.5
โ”œโ”€โ”€ @angular/[email protected] 
โ”œโ”€โ”€ @angular/[email protected] 
โ”œโ”€โ”€ @angular/[email protected] 
โ”œโ”€โ”€ @angular/[email protected] 
โ”œโ”€โ”€ @angular/[email protected] 
โ”œโ”€โ”€ @angular/[email protected] 
โ””โ”€โ”€ @angular/[email protected] 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @angular/[email protected] requires a peer of typescript@^2.1.5 but none was installed.
npm WARN [email protected] requires a peer of typescript@^2.1.0 but none was installed.

And my problem is that runing ng serve gives me the following error and the app does not run:

Cannot read property 'Private' of undefined
TypeError: Cannot read property 'Private' of undefined
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/compiler-cli/node_modules/tsickle/build/src/tsickle.js:111:40)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/compiler-cli/node_modules/@angular/tsc-wrapped/src/main.js:11:15)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/compiler-cli/node_modules/@angular/tsc-wrapped/index.js:14:14)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/compiler-cli/src/compiler_host.js:14:21)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/compiler-cli/src/codegen.js:15:23)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/compiler-cli/index.js:15:17)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@ngtools/webpack/src/plugin.js:6:24)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@ngtools/webpack/src/index.js:6:10)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/cli/tasks/eject.js:10:19)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/cli/models/webpack-configs/styles.js:7:17)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/cli/models/webpack-configs/index.js:10:10)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/cli/models/webpack-config.js:5:27)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/cli/tasks/serve.js:11:26)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Class.run (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/cli/commands/serve.js:94:27)
    at Class.<anonymous> (/home/andrea/Documentos/angular-apps/squizer/node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17)
    at process._tickCallback (internal/process/next_tick.js:103:7)

Mention any other details that might be useful.

Package.json

{
  "name": "squizer",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.0-rc.2",
    "@angular/common": "^4.0.0-rc.2",
    "@angular/compiler": "^4.0.0-rc.2",
    "@angular/compiler-cli": "^4.0.0-rc.2",
    "@angular/core": "^4.0.0-rc.2",
    "@angular/forms": "^4.0.0-rc.2",
    "@angular/http": "^4.0.0-rc.2",
    "@angular/platform-browser": "^4.0.0-rc.2",
    "@angular/platform-browser-dynamic": "^4.0.0-rc.2",
    "@angular/platform-server": "^4.0.0-rc.2",
    "@angular/router": "^4.0.0-rc.2",
    "@types/jquery": "^2.0.40",
    "core-js": "^2.4.1",
    "jquery": "^3.1.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-beta.32.3",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0-beta.4",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "~2.0.0"
  }
}

Most helpful comment

Hi,

I resolved this issue following the advice in https://github.com/angular/angular-cli/issues/5131

and :

deleted node_modules/ folder

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest

npm install typescript@latest --save-dev

All 3 comments

Hi,

I resolved this issue following the advice in https://github.com/angular/angular-cli/issues/5131

and :

deleted node_modules/ folder

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest

npm install typescript@latest --save-dev

Thanks yvelines,
Using npm outdated I also just realized that my typescript in the project was not updated, and I had to manually modify packages.json to use the latest version of typescript and as you say then run the command npm update --dev, and now ng serve is working again.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

5amfung picture 5amfung  ยท  3Comments

MateenKadwaikar picture MateenKadwaikar  ยท  3Comments

JanStureNielsen picture JanStureNielsen  ยท  3Comments

ericel picture ericel  ยท  3Comments

jmurphzyo picture jmurphzyo  ยท  3Comments