Error while running ng serve command in Angular 2 project

↘锁芯ラ 提交于 2020-02-24 14:50:10

问题


I have recently created a project using angular-cli and am unable to run it using ng serve

while running ng serve command it throws this error

Cannot read property 'AssetUrl' of undefined TypeError: Cannot read property 'AssetUrl' of undefined at Object. (/Users/shaan/Sites/node-apps/migration/Outgrow-frontend/node_modules/@angular/compiler-cli/src/private_import_compiler.js:10:51)


回答1:


Consider taking following steps:

  1. check your angular-cli.json and package.json for version of angular-cli in your project, it should be same e.g. ("version": "1.0.0-beta.x").

  2. install angular-cli as global package using

    npm install -g angular-cli

this should fix your problem.




回答2:


I solved issue by updating angular-cli to v1.0.0-beta.18 (which is latest build) and did "ng init" within local project folder.

follow https://github.com/angular/angular-cli#updating-angular-cli



来源:https://stackoverflow.com/questions/40238516/error-while-running-ng-serve-command-in-angular-2-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!