简体   繁体   中英

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

I have an angular 2 app using typescript which all compiles the ts and runs fine.

I have the default options for ignore paths which includes '\\node_modules\\'

Web Analyzer is reporting 6 errors in various .d.ts angular files even though these are in \\client\\\\node_modules\\@angular....

The error reported is TS2307 cannot find module '@angular/core' (or in some cases @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)

Does anyone know why Web Analyzer reports this error on project load and build, or how to fix it, or is this a bug? I can't find anything reported since ignore folders were added to tslint. i would expect errors in node_modules to be ignored, not that there are module missing errors for it to report anyway!

thanks, chris

In case it helps anyone I eventually solved this by switching to using commonJS instead of system modules in my project. Angular2 uses commonJS internally. Webanalyzer seems to be a lot happier with these, correctly locating all the angular modules and my own app's.

Worth noting that I also had resharper 2016.1 installed, which gave intellisense errors mirroring the Webanalyzer ones. Upgrading to resharper 2016.1.1 solved these.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM