在 Angular 2 项目中运行 ng serve 命令时出错 [英] Error while running ng serve command in Angular 2 project
问题描述
我最近使用 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"类型错误:无法读取未定义的属性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)
推荐答案
考虑采取以下步骤:
检查您的项目中的 angular-cli.json 和 package.json 版本,它应该是相同的,例如(版本":1.0.0-beta.x").
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屋!