angular-phonecat 项目无法启动

AngularJS教程: http://angularjs.cn/A00a

学习到第七章时:AngularJS入门教程07:路由与多视图

通过命令:git checkout -f step-7  下载了第七课后,在通过命令 npm start 启动项目时,抛出异常:

E:\workspaces\WebStorm workspaces\angular-phonecat>npm start

> angular-phonecat@0.0.0 prestart E:\workspaces\WebStorm workspaces\angular-phon
ecat
> npm install


> angular-phonecat@0.0.0 postinstall E:\workspaces\WebStorm workspaces\angular-p
honecat
> bower install

bower cached        git://github.com/angular/bower-angular.git#1.2.17
bower validate      1.2.17 against git://github.com/angular/bower-angular.git#=1
.2.17
bower cached        git://github.com/angular/bower-angular-route.git#1.2.17
bower validate      1.2.17 against git://github.com/angular/bower-angular-route.
git#=1.2.17
bower cached        git://github.com/angular/bower-angular.git#1.2.20
bower validate      1.2.20 against git://github.com/angular/bower-angular.git#1.
2.20
bower ECONFLICT     Unable to find suitable version for angular

npm ERR! angular-phonecat@0.0.0 postinstall: `bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat@0.0.0 postinstall script.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     bower install
npm ERR! You can get their info via:
npm ERR!     npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "D:\\Program Files (x86)\\nodejs\\\\node.exe" "D:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd E:\workspaces\WebStorm workspaces\angular-phonecat
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     E:\workspaces\WebStorm workspaces\angular-phonecat\npm-debug.log
npm ERR! not ok code 0

npm ERR! angular-phonecat@0.0.0 prestart: `npm install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat@0.0.0 prestart script.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm install
npm ERR! You can get their info via:
npm ERR!     npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "D:\\Program Files (x86)\\nodejs\\\\node.exe" "D:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! cwd E:\workspaces\WebStorm workspaces\angular-phonecat
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     E:\workspaces\WebStorm workspaces\angular-phonecat\npm-debug.log
npm ERR! not ok code 0

提示 bower ECONFLICT     Unable to find suitable version for angular


bower 没有找到合适的angular版本。

解决办法:

angular-phonecat 根目录下的 bower.json 文件

{
  "name": "angular-seed",
  "description": "A starter project for AngularJS",
  "version": "0.0.0",
  "homepage": "https://github.com/angular/angular-seed",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "angular": "1.2.x",
    "angular-mocks": "~1.2.x",
    "jquery": "1.10.2",
    "bootstrap": "~3.1.1",
    "angular-route": "~1.2.x"
  }
}

把angular 的版本修改,写死为 “=1.2.20”

{
  "name": "angular-seed",
  "description": "A starter project for AngularJS",
  "version": "0.0.0",
  "homepage": "https://github.com/angular/angular-seed",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "angular": "=1.2.20",
    "angular-mocks": "~1.2.x",
    "jquery": "1.10.2",
    "bootstrap": "~3.1.1",
    "angular-route": "=1.2.20"
  }
}

然后再用 npm start 命令启动,就能启动成功了。


E:\workspaces\WebStorm workspaces\angular-phonecat>npm start

> angular-phonecat@0.0.0 prestart E:\workspaces\WebStorm workspaces\angular-phon
ecat
> npm install


> angular-phonecat@0.0.0 postinstall E:\workspaces\WebStorm workspaces\angular-p
honecat
> bower install

bower not-cached    git://github.com/angular/bower-angular-route.git#=1.2.20
bower resolve       git://github.com/angular/bower-angular-route.git#=1.2.20
bower cached        git://github.com/angular/bower-angular.git#1.2.20
bower validate      1.2.20 against git://github.com/angular/bower-angular.git#1.
2.20
bower cached        git://github.com/angular/bower-angular.git#1.2.20
bower validate      1.2.20 against git://github.com/angular/bower-angular.git#=1
.2.20
bower download      https://github.com/angular/bower-angular-route/archive/v1.2.
20.tar.gz
bower extract       angular-route#=1.2.20 archive.tar.gz
bower invalid-meta  angular-route is missing "ignore" entry in bower.json
bower resolved      git://github.com/angular/bower-angular-route.git#1.2.20
bower install       angular#1.2.20
bower install       angular-route#1.2.20

angular#1.2.20 app\bower_components\angular

angular-route#1.2.20 app\bower_components\angular-route
└── angular#1.2.20

> angular-phonecat@0.0.0 start E:\workspaces\WebStorm workspaces\angular-phoneca
t
> http-server -p 8000

Starting up http-server, serving ./ on port: 8000
Hit CTRL-C to stop the server

通过 http://localhost:8000/app/index.html 访问,正常显示。



  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值