angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Problem to upgrade my project

Open zhouhao27 opened this issue 9 years ago • 8 comments

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.

zhouhao27 avatar Feb 13 '17 02:02 zhouhao27

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"
  }
}

delasteve avatar Feb 13 '17 02:02 delasteve

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

Brocco avatar Feb 13 '17 03:02 Brocco

@Brocco Thanks. It's working fine now.

zhouhao27 avatar Feb 13 '17 03:02 zhouhao27

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.

riteshwaghela avatar Feb 13 '17 07:02 riteshwaghela

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.

EdwardPayne avatar Feb 15 '17 10:02 EdwardPayne

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

melissamanjarres avatar Feb 22 '17 14:02 melissamanjarres

@delasteve your package settings worked for me .

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

engrashid avatar Mar 29 '17 08:03 engrashid

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.