-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
"error TS2307: Cannot find module" when using @types/ws with typescript 2.0 #11491
Comments
You need to explicitly specify "node" module resolution strategy, as the default for ES6 target is "classic". E.g.
|
Thanks @jonrimmer. this is the correct workaround for The issue has been fixed in |
@jonrimmer thanks! this cost my serval hours to study... and had not found any solution until read from your post. why tsc not to search @types by default? |
as a mentioned, it is a bug, reproted in #11103, and fixed. sorry about the confusion. passing |
@mhegazy got it. thanks! |
TypeScript Version:
2.0.3
Code
$ npm install @types/ws wechaty@0.4.0 /Users/zixia/git/wechaty └── @types/ws@0.0.34 $ ./node_modules/.bin/tsc --target es6 t.ts t.ts(1,28): error TS2307: Cannot find module 'ws'.
Expected behavior:
should found the type defination of
ws
Actual behavior:
TS2307 error
It's not like the problem from
@types/ws
, because if i use another module like@types/express
, will be the same error.BTW: if i run without es6 target, it will ok, but I can't use async/await
$ ./node_modules/.bin/tsc t.ts # will be ok
http://stackoverflow.com/questions/39960436/error-ts2307-cannot-find-module-when-using-types-ws-with-typescript-2-0
The text was updated successfully, but these errors were encountered: