-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find module 'request'/'form-data' #5
Comments
@friedemannsommer Since you are watching I am very sorry that I can't help. I never used TypeScript before. But I googled "TS2307" and it seems you may fix it by changing the search paths and working directory of your TypeScript compiler. |
Hi @morphatic you need to update your tsconfig.json that it looks like this: The property "moduleResolution" was missing in your tsconfig.json. If you want to use modules from the node_modules directory you need to add the property "moduleResolution" with the value "node". For more Information about TypeScript module resolution checkout the docs: https://www.typescriptlang.org/docs/handbook/module-resolution.html {
"compilerOptions": {
"module": "es6",
"target": "es6",
"declarationDir": "dist",
"moduleResolution": "node",
"pretty": true,
"declaration": true,
"noImplicitAny": true,
"removeComments": true,
"noImplicitReturns": true,
"suppressImplicitAnyIndexErrors": true
},
"include": [
"src/**/*.ts"
]
} |
This issue is microsoft/TypeScript#11103. This is broken in 2.0.9, but is fixed in 2.1.1. Also:
|
@friedemannsommer Thanks for helping out! @andy-ms Thanks for your info. I'll keep that in mind for the next time a TypeScript-related issue is opened! @morphatic Does this fix your issue? |
Yes! This fixed it. It also solves a HUGE mystery that I've been wrestling with for two weeks. TYVM!!! |
The Problem
I'm building a package that depends on
request-promise-native
. When I try to compile, I'm getting the following errors on the console:I can't figure out why this is happening or how to make these errors go away.
Implementation Details
Here are the relevant bits from
package.json
:Here is my
tsconfig.json
:And here is an example of how I'm using
rpn
in my code:I'm positive that both the
request
andform-data
packages are installed innode_modules
. Their type definitions are also installed innode_modules/@types
. FWIW, when I tried this withrequest-promise
I also got an error saying thatBluebird
was not being found. I'm under the impression that @andy-ms and others from Microsoft are maintaining the type definitions for this package, so I'm a little puzzled as to why I'm getting this error. FYI, I'm using typescript v2.0.9. Thanks!The text was updated successfully, but these errors were encountered: