How to enable Node.js code autocompletion in VSCode?

Per Microsoft's Documentation: https://code.visualstudio.com/docs/nodejs/working-with-javascript

IntelliSense for JavaScript libraries and frameworks is powered by TypeScript type declaration (typings) files.

Automatic type acquisition requires npmjs, the Node.js package manager, which is included with the Node.js runtime.

In my situation, I do not have npmjs installed and that's why automatic type acquisition fails.

*Edit, that is, after installing npm, my autocomplete starting working successfully for node related hints.


You will need to tell VS Code about the types in Node JS (as you hit at yourself in the comment). To do this you can install the types for node running the following command (assuming you have already run npm init):

npm install --save-dev @types/node

It will install the types for Node JS, which VS Code automatically picks up and you'll be auto-completing all Node JS-specific things going forward. You don't even have to restart VS Code.

As you are adding more dependencies to your project (if you will be doing so). Many of them have a @types/X package as well (if they don't have the already included in the package), which will allow autocomplete as well.