Visual Studio 2015 - Typescript "Build:Cannot find module..."

11,975

I had an app that showed the 'cannot find module' message in the editor when viewed in Visual Studio 2015 [TypeScript 2.0.6] - but worked perfectly in VSCode!

I tried all the recommended changes found on StackOverflow and on other sites but none of them worked for me. The change that fixed my problem was to remove the 'outDir' property from the tsconfig file! I know that the code in the original question does not use the outDir property but this answer may help somebody else.

This change was also necessary for VS2017. My suggestion: use VSCode if possible! :)

Share:
11,975
Victor
Author by

Victor

Updated on July 21, 2022

Comments

  • Victor
    Victor almost 2 years

    I'm trying to add Typescript to an existing .NET MVC project. I however get weird error-messages when I try to build. The Intellisense works and I can see that the typeings works. I can also see the .js-files being generated on manual save, meaning that the compileOnSave works. It's only when I try to build the whole project the errors show up.

    enter image description here

    I use the following settings in Visual Studio 2015:

    • Have installed typescript 2.0.3

    • Added the following devDependencies in my package.json-file

    enter image description here

    • My tsconfig-file looks like this

    enter image description here

    • This is how i import the dependencies specified in the package.json-file.

    enter image description here