在Angular 2项目中运行ng serve命令时出错 [英] Error while running ng serve command in Angular 2 project

查看:137
本文介绍了在Angular 2项目中运行ng serve命令时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近使用angular-cli创建了一个项目,无法使用ng serve来运行它

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

在运行ng serve命令时会抛出此错误

while running ng serve command it throws this error

无法读取未定义的属性"AssetUrl"TypeError:无法读取未定义的属性"AssetUrl"在对象.(/Users/shaan/Sites/node-apps/migration/Outgrow-frontend/node_modules/@angular/compiler-cli/src/private_import_compiler.js:10:51)

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. 在项目中检查angular-cli.json和package.json的angular-cli版本,例如(版本":"1.0.0-beta.x").

  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").

使用

npm install -g angular-cli

npm install -g angular-cli

这应该可以解决您的问题.

this should fix your problem.

这篇关于在Angular 2项目中运行ng serve命令时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆