【问题标题】:angular/cli and typescript version compilation errorangular/cli 和 typescript 版本编译错误
【发布时间】:2017-12-26 12:37:00
【问题描述】:

我正在将我的项目升级到 angular5。

在我的 package.json 中:

"dependencies": {    
   "highcharts-export-csv": "git+https://github.com/highcharts/export-csv.git"
 }
"devDependencies": {
    "@angular/cli": "1.6.2",
    "@angular/compiler-cli": "~5.1.2",
    "typescript": "^2.6.2"
}

它有效,但我收到警告:

@angular/compiler-cli@5.1.2 requires typescript@'>=2.4.2 <2.6.0' but 2.6.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.

Please run the following command to install a compatible version of TypeScript.

npm install typescript@'>=2.4.2 <2.6.0'

To disable this warning run "ng set warnings.typescriptMismatch=false".

所以,我将我的 typescript 版本更改为 2.5.3,但现在我有编译错误,当 cli 和 typescript 版本不匹配时我没有。

这是一个很长的错误,但如果我没有错,这里是关键:

ERROR in ./src/app/myCsv/myCsv.module.ts
Module not found: Error: Can't resolve 'highcharts-export-csv' in '/myRoute/myCsv'
resolve 'highcharts-export-csv' in '/myRoute/src/app/myCsv'
Parsed request is a module
using description file: /myRoute/package.json (relative path: ./src/app/myCsv)
Field 'browser' doesn't contain a valid alias configuration
 after using description file: /myRoute/package.json (relative path: ./src/app/myCsv)
resolve as module

【问题讨论】:

  • 我不明白如何安装 2.6.2 typescript 版本,但没有显示警告。我可以忽略它吗?

标签: typescript highcharts angular5


【解决方案1】:

您可以使用

从 Angular CLI 禁用 TS 警告
ng set warnings.typescriptMismatch=false

【讨论】:

  • 好的,这就是我粘贴的警告,我想它比忽略更好解决,我更喜欢在我的依赖项中使用兼容版本。还是谢谢你!
猜你喜欢
  • 2017-08-06
  • 2016-04-02
  • 2018-04-21
  • 1970-01-01
  • 2017-09-07
  • 2018-11-28
  • 2017-11-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多