Skip to content

Cannot find type names #21

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jdk339 opened this issue Oct 24, 2017 · 1 comment
Closed

Cannot find type names #21

jdk339 opened this issue Oct 24, 2017 · 1 comment

Comments

@jdk339
Copy link

jdk339 commented Oct 24, 2017

I keep getting this error when compiling my Angular 2 project:

ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (1,23): Cannot find module 'http'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (2,26): Cannot find module 'stream'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (103,40): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (105,82): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (106,19): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (111,16): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (158,11): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (159,12): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (161,10): Cannot find name 'Buffer'.

I get this after running:

npm install --save web-request
npm install @types/node

When I view the code in web-request/index.d.ts in my code editor there is no error; it just shows up in compilation.

Node version: v6.11.3

@jdk339
Copy link
Author

jdk339 commented Oct 25, 2017

I resolved the issue by adding "node" to my types property in the compilerOptions object of tsconfig.app.json.

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": ["node"]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

Went here to figure that out: aws/aws-sdk-js#1271

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant