angular2,打字稿对等体无效,无法导入模块 [英] angular2, typescript peer invalid, can't import modules

查看:51
本文介绍了angular2,打字稿对等体无效,无法导入模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个问题,大概是相互依赖的:

  1. 我无法要求/导入sass@0.5.0
  2. 打字稿有效,但我看到错误

通过命令npm列表:

├── sass@0.5.0 extraneous
├── systemjs@0.19.27
├── typescript@1.8.10 peer invalid
├── typings@1.3.3
└── zone.js@0.6.17

npm ERR! extraneous: sass@0.5.0 C:\Users\AxOn\Documents\projects\NODETS+ANGULAR2\public\node_modules\sass
npm ERR! peer invalid: typescript@1.8.10 C:\Users\AxOn\Documents\projects\NODETS+ANGULAR2\public\node_modules\typescript

适当地,由于typescript@1.8.10对等无效,我看不到模块:

从'sass'导入{sass};//错误

C:\Users\AxOn\Documents\projects\NODETS+ANGULAR2\public>npm install sass --save
npm WARN package.json angular2-quickstart@1.0.0 No description
npm WARN package.json angular2-quickstart@1.0.0 No repository field.
npm WARN package.json angular2-quickstart@1.0.0 No README data
npm WARN excluding symbolic link index.js -> lib/sass.js
npm WARN excluding symbolic link lib\index.js -> sass.js
npm WARN unmet dependency C:\Users\AxOn\Documents\projects\NODETS+ANGULAR2\public\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client requires component-emitter@'1.1.2' but will load

npm WARN unmet dependency C:\Users\AxOn\Documents\projects\NODETS+ANGULAR2\public\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\component-emitter,
npm WARN unmet dependency which is version 1.2.0
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "sass" "--save"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package typescript@1.8.10 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/compiler-cli@0.6.0 wants typescript@^2.0.2

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\AxOn\Documents\projects\NODETS+ANGULAR2\public\npm-debug.log

之后,packege.json中不存在sass

after, sass is absent in packege.json

"devDependencies": {
    "concurrently": "^2.2.0",
    "lite-server": "^2.2.2",
    "typescript": "^1.8.10",
    "typings":"^1.3.2"
  }

推荐答案

将打字稿的版本设置为2.0.2有助于解决我的打字稿错误.

Setting typescript's version to 2.0.2 helped to fix the typescript error in my case.

"devDependencies": {
    // other dependecies ...
    "typescript": "^2.0.2",
    // other dependecies ...
  }

此错误可能是由于升级了angular-compiler及其依赖项而导致的,而忘记了升级文档.

May be this error is the result of an upgrade of the angular-compiler and it's dependencies while forgetting to upgrade the documentation.

这篇关于angular2,打字稿对等体无效,无法导入模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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