1

A friend recommended that I swap over to Typescript from javascript, as a way to deal with the problems I was having implementing promises in loops and conditionals (TS has async/await functionality). I can never seem to get TS compiling properly. The latest error I got on the VSCODE terminal (which is different to the set of errors I was getting on the console) was:

error TS6053: File 'c:/stuff/node_modules/@types/node/index.d.ts' not found.

So I created that directory structure and put index.d.ts in there and now I am getting these errors:

node_modules/@types/node/index.d.ts(6,25): error TS2307: Cannot find module 'stream'.
node_modules/@types/node/index.d.ts(14,32): error TS2304: Cannot find name 'Buffer'.
node_modules/@types/node/index.d.ts(15,78): error TS2304: Cannot find name 'Buffer'.
node_modules/@types/node/index.d.ts(23,39): error TS2304: Cannot find name 'Buffer'.
8
  • The latest versions of Node have async/await. Commented Sep 14, 2017 at 3:01
  • ...is that 6.x? Commented Sep 14, 2017 at 3:03
  • nodejs.org 8.5 is the latest version. Async/Await arrive in version 8. Commented Sep 14, 2017 at 3:03
  • Ok. How do I go about updating to that version? I'm new to node Commented Sep 14, 2017 at 3:04
  • I like n - it makes switching between versions easy: github.com/tj/n Commented Sep 14, 2017 at 3:05

1 Answer 1

4

it's not a correct way to solve your problem by doing:

created that directory structure and put index.d.ts in there

the correct way is installing @types/node by npm command in VSCode terminal (MENU: View > Integrated Terminal):

npm install @types/node --save-dev

Before you install it, you'd better delete "@types" folder manually.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.