Definitelytyped: node_modules/@types/request-promise/errors.d.ts(1,21): error TS2307: Cannot find module '.'.

Created on 19 Oct 2017  路  2Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [X] I tried using the @types/xxxx package and had problems.
  • [X] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [X] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [X] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @cglantschnig @joeskeen @AyaMorisawa

node_modules/@types/request-promise/errors.d.ts(1,21): error TS2307: Cannot find module '.'.

import rp = require('.');
~~~~~~~~~~~~~~~~~~~~~^

Most helpful comment

@Jack-Works
in your tsconfig.json file, you have to set the following compiler option:

  "compilerOptions": {
      "moduleResolution": "node"
  }

or run tsc with that flag : tsc --moduleResolution node

All 2 comments

I am getting this error as well.

A workaround is to edit node_modules/@types/request-promise/errors.d.ts such that import rp = require('.'); becomes import rp = require('request-promise');.

@Jack-Works
in your tsconfig.json file, you have to set the following compiler option:

  "compilerOptions": {
      "moduleResolution": "node"
  }

or run tsc with that flag : tsc --moduleResolution node

Was this page helpful?
0 / 5 - 0 ratings