Search code examples
visual-studio-codenpm-installvscode-extensions

Why some VS code extensions cannot be installed with NPM


I can install the Prettier extension using npm command:

npm i --save-dev --save-exact prettier

This same extension can be installed from the Extension Manger of VS-Code.

My question is why some Extensions cannot be installed using the NPM command?

For example: dsznajder.es7-react-js-snippets


Solution

  • You are confusing two concepts here. One is what's called a node package or a node module (they have a slightly different meaning), which can be installed from NPM, independently of your IDE (be it VS Code or something else).

    And you have extensions for VS Code, which are installed from the VS Code Marketplace (as mentioned in the comments already). These are not the same as a node module/package, but may (or may not) use NPM packages.

    So, when you install the prettier node module, you have only installed the actual prettier code (same for other things like eslint). The prettier extension uses this node module to do its work. However, extension usually come with all their required node modules, so it's not necessary to install them manually.