angular.js - Angular2教程包typings无法安装的问题。
迷茫
迷茫 2017-05-15 17:07:42
0
1
768

Angular2的教程包--英雄编辑器,在初建环境的时候发生了typings无法安装的错误。
同样的包,在Windows和Mac环境下都可以正常使用,没有出现一点问题。
包的地址:
angular2-tour-of-heroes

在Ubuntu下,Nodejs版本升级至6.8.0,npm版本3.10.8.

在包下运行
报错,报错信息

$ npm install
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130

> angular2-tour-of-heroes@1.0.0 postinstall /home/xiaofuyesnew/workspace/angular2-tour-of-heroes
> typings install


npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN angular2-tour-of-heroes@1.0.0 No repository field.
npm ERR! Linux 4.4.0-42-generic
npm ERR! argv "/usr/local/n/versions/node/6.8.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.8.0
npm ERR! npm  v3.10.8
npm ERR! file sh
npm ERR! path sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn sh
npm ERR! angular2-tour-of-heroes@1.0.0 postinstall: `typings install`
npm ERR! spawn sh ENOENT
npm ERR! 
npm ERR! Failed at the angular2-tour-of-heroes@1.0.0 postinstall script 'typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-tour-of-heroes package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-tour-of-heroes
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-tour-of-heroes
npm ERR! There is likely additional logging output above.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN angular2-tour-of-heroes@1.0.0 No repository field.
npm ERR! Linux 4.4.0-42-generic
npm ERR! argv "/usr/local/n/versions/node/6.8.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.8.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! angular2-tour-of-heroes@1.0.0 postinstall: `typings install`
npm ERR! Exit status -2
npm ERR! 
npm ERR! Failed at the angular2-tour-of-heroes@1.0.0 postinstall script 'typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-tour-of-heroes package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-tour-of-heroes
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-tour-of-heroes
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/xiaofuyesnew/workspace/angular2-tour-of-heroes/npm-debug.log

已经尝试过npm install typings -g,报错依旧。

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

Antworte allen(1)
滿天的星座

还是自己来吧,最主要的原因还是在NPM上,因为用了n来管理nodejs的版本,npm依赖的是nodejs,而n管理node的版本时因为也要依赖node所以有时候会出现一些问题,去找了一下tj大神的n发布页面,上面提到在使用n来切换版本之后,需要修复一下node与npm之间的关系,否则npm很可能出现问题。
即在使用完n切换版本之后,需要运行以下脚本,来修复npm

$ curl -0 -L https://npmjs.org/install.sh | sudo sh

视你终端的配置,取舍后面的sudo

参考链接:tj/n

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage