Skip to content

TS-Check: cannot find module #28233

Closed
Closed
@NileDaley

Description

@NileDaley

TypeScript Version: 3.1.3

Code

//@ts-check
const { axios } = require('axios')

Expected behavior:
Axios will be required from './node_modules/axios/index'

Actual behavior:
Error shown is cannot find module 'axios' despite axios being installed. Note that this problem is not axios specific, it occurs with any module. However, if I use the following syntax then it is required correctly.

//@ts-check
const { axios } = require('./node_modules/axios/index')

Screenshots:

The error:

screenshot 2018-10-30 at 16 17 51

No error when using path:

screenshot 2018-10-30 at 16 18 21

TypeScript debug error:

screenshot 2018-10-30 at 16 19 56

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: TSServerIssues related to the TSServer

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions