Angular-cli: Error when running ng serve after upgrade to Angular 2.1.1

Created on 22 Oct 2016  Â·  9Comments  Â·  Source: angular/angular-cli

I am trying to upgrade my Angular version to 2.1.1. This is my package.json:

  "dependencies": {
    "@angular/common": "~2.1.1",
    "@angular/compiler": "~2.1.1",
    "@angular/core": "~2.1.1",
    "@angular/forms": "~2.1.1",
    "@angular/http": "~2.1.1",
    "@angular/platform-browser": "~2.1.1",
    "@angular/platform-browser-dynamic": "~2.1.1"
   ...
}

When I am running ng serve after the upgrade I'm getting this error:

Cannot read property 'AssetUrl' of undefined
TypeError: Cannot read property 'AssetUrl' of undefined
at Object. (node_modules/@angular/compiler-cli/src/private_import_compiler.js:10:51)

Most helpful comment

Looks like a version mismatch!

  1. delete node_modules
  2. do a fresh npm i [email protected] -g
  3. do again ng init
  4. Y --> override package.json
  5. report if this worked! 😉

All 9 comments

Looks like a version mismatch!

  1. delete node_modules
  2. do a fresh npm i [email protected] -g
  3. do again ng init
  4. Y --> override package.json
  5. report if this worked! 😉

But after your changes I can continue work on the same project without generate new one?

Sure. ng init will override all initial files, but will not delete other stuff.
Your changes to the initial files will be overridden (that's why you have to confirm this with Y).

But your project should be anyway under git version control, so that you can hand-pick the updated lines that you want to keep and those which you want to revert.

Just want to confirm that the solution posted by @JohannesHoppe worked well for me, thanks!

It came to me all the same.
Trying @JohannesHoppe ‘s solution.
Hope solving it.....

ok the "AssetUrl"-problem won't bother me any more.
But another comes out.
Here it is

ERROR in ./src/app/index/index.component.ts
Module not found: Error: Can't resolve '@ng-bootstrap/ng-bootstrap' in '/Users/LiuSheng/Java/workspace/ovit-java-framework/web/src/app/index'
@ ./src/app/index/index.component.ts 12:0-63
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main

Whether it's the bootstrap-version‘s problem or not?
I'm so confused.....

Did you install @ng-bootstrap/ng-bootstrap again after ng init?

Yes, I installed "ng-bootstrap" after ng init.
It fixed my issues.
My local peoject runs.
Did you have the same problem or something else?

On Oct 27, 2016 3:49 PM, kvriesacker [email protected] wrote:

Did you install @ng-bootstrap/ng-bootstrap again after ng init?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/angular/angular-cli/issues/2835#issuecomment-256571468, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQStP8bYJ1ZlrAmRcJetLh3DwWkjtLCoks5q4FeZgaJpZM4Kd9BI.

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