[英]Web Analyzer TSLint reports error TS2307 Cannot find module '@angular/core' in ignored node_modules files
I'm using Web Analyzer 1.7.75 in visual studio 2015 update 2 (14.0.25123), also resharper ultimate 2016.1 我在Visual Studio 2015 Update 2(14.0.25123)中使用了Web Analyzer 1.7.75,也重新共享了Ultimate 2016.1
I have an angular 2 app using typescript which all compiles the ts and runs fine. 我有一个使用typescript的angular 2应用程序,可以全部编译ts并运行良好。
I have the default options for ignore paths which includes '\\node_modules\\' 我有忽略路径的默认选项,其中包括“ \\ node_modules \\”
Web Analyzer is reporting 6 errors in various .d.ts angular files even though these are in \\client\\\\node_modules\\@angular.... 即使它们位于\\ client \\\\ node_modules \\ @angular中,Web Analyzer仍会报告各种.d.ts角度文件中的6个错误。
The error reported is TS2307 cannot find module '@angular/core' (or in some cases @angular/common) 报告的错误是TS2307找不到模块'@ angular / core'(或在某些情况下@ angular / common)
The app runs without error in a browser, and all the angular modules loaded ok, and were fetched fine by npm (using latest as visual studio's inbuilt version will not fetch angular2 as too old, so i know of that issue and it isn't that) 该应用程序在浏览器中运行没有错误,并且所有的角度模块都可以正常加载,并被npm很好地获取(使用最新版本,因为Visual Studio的内置版本不会获取angular2的版本太旧,因此我知道该问题,并且不是那)
Does anyone know why Web Analyzer reports this error on project load and build, or how to fix it, or is this a bug? 有谁知道为什么Web分析工具会在项目加载和生成时报告此错误,或者如何解决该错误,或者这是一个错误? I can't find anything reported since ignore folders were added to tslint.
由于将忽略文件夹添加到tslint,因此找不到任何报告的报告。 i would expect errors in node_modules to be ignored, not that there are module missing errors for it to report anyway!
我希望可以忽略node_modules中的错误,而不是因为有模块丢失的错误要报告!
thanks, chris 谢谢,克里斯
In case it helps anyone I eventually solved this by switching to using commonJS instead of system modules in my project. 万一它对任何人都有帮助,我最终通过切换到使用commonJS而不是项目中的系统模块来解决此问题。 Angular2 uses commonJS internally.
Angular2在内部使用commonJS。 Webanalyzer seems to be a lot happier with these, correctly locating all the angular modules and my own app's.
Webanalyzer似乎对这些功能非常满意,可以正确定位所有的角度模块和我自己的应用程序。
Worth noting that I also had resharper 2016.1 installed, which gave intellisense errors mirroring the Webanalyzer ones. 值得一提的是,我还安装了reshaper 2016.1,这给了智能感知错误,它们反映了Webanalyzer的错误。 Upgrading to resharper 2016.1.1 solved these.
升级到重新共享器2016.1.1解决了这些问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.