Angular-cli: Problem to upgrade my project

Created on 13 Feb 2017  ยท  8Comments  ยท  Source: angular/angular-cli

My project was running well until I upgrade my angular-cli recently.

OS?

Mac OSX 10.12.3

Current project package.json:

"dependencies": {
    "@angular/common": "2.2.3",
    "@angular/compiler": "2.2.3",
    "@angular/core": "2.2.3",
    "@angular/forms": "2.2.3",
    "@angular/http": "2.2.3",

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

@angular/cli: 1.0.0-beta.30
node: 7.5.0
os: darwin x64
@angular/common: 2.2.3
@angular/compiler: 2.2.3
@angular/core: 2.2.3
@angular/forms: 2.2.3
@angular/http: 2.2.3
@angular/platform-browser: 2.2.3
@angular/platform-browser-dynamic: 2.2.3
@angular/router: 3.2.3
@angular/compiler-cli: 2.2.3

Repro steps.

ng serve

Got the following error message:

This version of CLI is only compatible with angular version 2.3.1 or better. Please
upgrade your angular version, e.g. by running:

npm install @angular/core@latest 

Then I upgraded by:

npm install @angular/core@latest

Got the follow message:

[email protected] /Users/zhouhao/Projects/parse-live-query/ParseChat/angular-client
โ”œโ”€โ”€ UNMET PEER DEPENDENCY @angular/[email protected]
โ”œโ”€โ”€ UNMET PEER DEPENDENCY @angular/[email protected]
โ”œโ”€โ”€ UNMET PEER DEPENDENCY @angular/[email protected] invalid
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ @angular-cli/[email protected]
โ”‚ โ”‚ โ””โ”€โ”€ @angular/[email protected] 
โ”‚ โ”œโ”€โ”€ UNMET PEER DEPENDENCY @angular/[email protected]
โ”‚ โ”œโ”€โ”€ UNMET PEER DEPENDENCY @angular/tsc-wrapped@^0.5.0
โ”‚ โ”œโ”€โ”€ UNMET PEER DEPENDENCY [email protected]
โ”‚ โ””โ”€โ”€ UNMET PEER DEPENDENCY [email protected]
โ”œโ”€โ”€ UNMET PEER DEPENDENCY [email protected]
โ””โ”€โ”€ UNMET PEER DEPENDENCY [email protected]

Run project again

ng serve

Got the following error message:

ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (/Users/Projects/parse-live-query/myapp/angular-client/node_modules/typescript/lib/typescript.js:8062:20)
at Object.createCompilerHost (/Users/Projects/parse-live-query/myapp/angular-client/node_modules/typescript/lib/typescript.js:44978:26)
at Object.ngcLoader (/Users/Projects/parse-live-query/myapp/angular-client/node_modules/@ngtools/webpack/src/loader.js:341:33)
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts

Any idea? Thanks.

All 8 comments

We might want to make that message a bit clearer as @angular/core isn't the only package you will need to update. Try replacing your package.json with the following, where appropriate:

  "dependencies": {
    "@angular/common": "^2.4.0",
    "@angular/compiler": "^2.4.0",
    "@angular/core": "^2.4.0",
    "@angular/forms": "^2.4.0",
    "@angular/http": "^2.4.0",
    "@angular/platform-browser": "^2.4.0",
    "@angular/platform-browser-dynamic": "^2.4.0",
    "@angular/router": "^3.4.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-beta.31",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.0"
  }
}

@zhouhao27 can you confirm that updating the @angular libs has worked for you?

@Brocco Thanks. It's working fine now.

I am also getting the same error. When I tried to install the above mentioned packages mentioned by @delasteve, I am getting No compatible version found: [email protected]. @zhouhao27 can you please confirm if you could install angular-cli successfully? Thanks.

I had the same problem but now when i run ng build och ng serve i get:
"You have to be inside an angular-cli project in order to use the build command."

I am of course in my angular-cli project when I'm running this.

Hello @riteshwaghela did you find a solution to your problem? Thanks

@delasteve your package settings worked for me .

just had to replace "assets: "assets" to "assets: [ "assets" ] in angular-cli.json file

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

brtnshrdr picture brtnshrdr  ยท  3Comments

delasteve picture delasteve  ยท  3Comments

sysmat picture sysmat  ยท  3Comments

hareeshav picture hareeshav  ยท  3Comments

NCC1701M picture NCC1701M  ยท  3Comments