cannot find module 'angular2/core'

cannot find module "." require
cannot find module '@angular
error cannot find module discord
cannot find module .'' - ionic
cannot find module ts
cannot find module 'express'
cannot find module 'acorn'
cannot find module 'react

These red squiggly lines say cannot find module 'angular2/core',cannot find module 'angular2/router',cannot find module 'angular2/http'. I checked other posts in SO but it seems they have no appropriate answer.

I also added a reference to the d.ts files as seen below but still not working.

Other posts say that I need to configure something in the tsconfig.json file but I am using Visual Studio and I see no need to use the tscompiler suggested by the angular team because Visual Studio should be able to compile ts files automatically.

Am I missing something?

Is the tsconfig.json still required even if you use Visual Studio?

How do I get rid of these squiggly lines?

Thanks!

(I am using Visual Studio 2015 and latest Typescript engine)

UPDATE: I am not sure what exactly is the npm package manager. But I have a pre-built package.json file that was created when the project was created. I use this file for installing npm packages.

For ASP.NET 5.0 applications in VS 2015, configuring typescript is a bit challenging.

Until the tooling around typescript improves, you can configure typescript manually:

Step 1: Right-click project, and Unload Project 
Step 2: Right-click the unloaded project, and Edit the .xproj file
Step 3: Add a PropertyGroup node, under the Project node:

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
    <TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
    <TypeScriptOutFile />
    <TypeScriptOutDir />
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
    <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
    <TypeScriptSourceMap>True</TypeScriptSourceMap>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
    <TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
  </PropertyGroup>

Step 4: Right-click the unloaded project and Reload Project
Step 5: Re-build project

If you are still encountering the error where it cannot find the module, exit visual studio and reload the solution.

How to solve "Error: Cannot find module '*.js'" with Node.js , Introduction. If you are trying to run your Node.js application and you get something like this: Error: Cannot find module 'C:\Users\Me\my_app.js'. After pulling down a module from GitHub and following the instructions to build it, I try pulling it into an existing project using: This appears to do the trick: But Node.js can't find the module: I really want to understand what is going on here, but I'm at a bit of a loss as to where to look next. The node_modules directory is expected to be

Here is my working settings:

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
  <TypeScriptTarget>ES5</TypeScriptTarget>
  <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
  <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
  <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
  <TypeScriptModuleKind>System</TypeScriptModuleKind>
  <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
  <TypeScriptOutFile />
  <TypeScriptModuleResolution>NodeJs</TypeScriptModuleResolution>
  <TypeScriptOutDir />
  <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
  <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
  <TypeScriptSourceMap>True</TypeScriptSourceMap>
  <TypeScriptMapRoot />
  <TypeScriptSourceRoot />
  <TypeScriptEmitDecoratorMetadata>True</TypeScriptEmitDecoratorMetadata>
  <TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
</PropertyGroup>

Restart Visual Studio after applying this to your web project.

Uncaught Error: Cannot find module "." · Issue #4921 · webpack , What is the current behavior? Below exception: polyfills.js:1 Error: Cannot find module "." at webpackMissingModule (eval at 148 (http://localhost:  Error: Cannot find module 'C:\Users\Me\my_app.js'. then you are most likely trying to run the wrong file. It is possible you are missing a dependency that is needed from npm install, but if it says it cannot find the main file you are trying to run, then you are trying to run a file that does not exist.

For VS2015, go to Tools -> Options -> Text Editor -> TypeScript -> Project -> General then tick "Automatically compile TypeScript files which are not part of a project" then select "Use CommonJS code generation for modules.."

Error: Cannot find module 'open' when running server · Issue #5 , scripts/web-server.sh module.js:340 throw err; ^ Error: Cannot find module 'open' at Function.Module._resolveFilename (module.js:338:15) at Function.Module. In my case it is “ /usr/local/bin/npm ” and now note down the path. Navigate to the /usr/local with the help of finder/ explorer. You will find the folder called “lib” and within that “lib” folder you will be able to see node_modules folder, which is your global level module folder.

How do I resolve "Cannot find module" error using Node.js?, Could not find a package JSON Are you in a node project? Why GitHub? Features →. Code review; Project management; Integrations; Actions; Packages; Security

I too encountered this error and what worked for me was, unloading the project and checking the .csproj file. I found that this snippet was added there -

  <ItemGroup>
    <None Remove="ClientApp\components\componentname\componentname.ts" />
  </ItemGroup>

Removing this code, saving the csproj then reloading the project worked. Hope this helps!

nodejs - what is the location of node-modules, It's installed in the package.json but keeps throwing the error. Using this: https://​www.npmjs.com/package/aq3d module.js:491 throw err; ^ Error: Cannot find  I'm attempting to integrate React into an existing web page. At this time, I'm unable to get my React app loaded. My React app has two files. At this time, they look like this: myApp.js import Re

npm can't find package.json, getting a log error from glitch regarding the express module which points to the server.js file: Package.json file looks like this: { “author”:  By design, each node module has its own private internal dependencies. If you want to use any, your app will need to install them too. It means your app can use a different version of the modules, and each module can internally use different versions again without conflicts.

Error: Cannot find module [Solved] - Glitch Help, Error: Cannot find module 'request-promise'. I assumed that any dependencies would be automatically installed when action.yml specified  This has nothing to do with not being able to find a module. this just means the angular cli module will be updated for any version 1.6.x – SanSolo Dec 20 '18 at 11:18 add a comment | 3

Managing Packages with Npm, What's issue Cannot find module Just Type command in terminal or command prompt npm Duration: 2:09 Posted: Oct 24, 2017 Find-Module returns the newest version of a module if no parameters are used that limit the version. To get a repository's list of a module's versions, use the parameter AllVersions. If the MinimumVersion parameter is specified, Find-Module returns the module's version that is equal to or greater than the minimum.

Comments
  • If you use npm as the package manager, right click the project > properties. In Typescript build select CommonJs as the module loader
  • I right click on the project and clicked Properties. I only see three tabs: Application, Build and Debug. In the Build tab, there are Produce outputs on build and Compile typescript on build checkboxes. There's also the Configuration and Platform combo-boxes. There is no module loader option. This is an ASP.NET 5 web project.
  • Setting for CommonJS solved my problem in Visual Studio 2015 Pro. thanks @pixelbits
  • It is all grayed out in Typescript build for me
  • @TomStickel it will be grayed out if you have tsconfig.json defined in your project. You can accomplish the same thing by adding this to the file: "compilerOptions": { "module": "commonjs" }
  • wow it worked! here's also the other XML tags for compiler options of typescript. https://github.com/Microsoft/TypeScript/wiki/Setting-Compiler-Options-in-MSBuild-projects. Just a tiny problem, the ng and router variables are still highlighted in red. I thought its just the ExperimentalDecorator, but it is already set to true.
  • I've tried the same thing with visual studio 2013, but still I am getting the same issue. Is there anything I've missed?
  • maybe, i'll post my settings
  • I found this site extremely useful, it lists all of the options you can put in the project file. github.com/Microsoft/TypeScript/wiki/…
  • Thanks @pixelbits It solved my build issues also. Excellent this is what I was looking for.
  • This is the best solution if you are using node.js/npm and following the angular2 tutorial from angular.io/docs/ts/latest/tutorial
  • This set of tags worked for me. I think <TypeScriptModuleResolution>NodeJs</TypeScriptModuleResolution> was the key to fixing the bug I was seeing (same as what the OP posted).