# Configure JavaScript libraries

> **TL;DR**
> Required plugin:
>
>
>
> `JavaScript and TypeScript` -    the plugin is bundled with IntelliJ IDEA and enabled by default.

In context of the language and the IDE, a library is a file or a set of files. Functions and methods of these files are added to IntelliJ IDEA's internal knowledge in addition to the functions and methods that IntelliJ IDEA retrieves from the project code that you edit.  In the scope of a project, its libraries by default are write-protected.

IntelliJ IDEA reserves two predefined auto-generated library folders:

* `node_modules` for keeping Node.js packages listed in the `dependencies` object of your project `package.json`. For more information, refer to [Configuring node_modules library](#ws_js_libraries_examples_node_modules).

* `External Libraries` for storing downloaded [TypeScript definition files](#ws_js_configure_libraries_ts_definition_files) or [libraries referenced via CDN links](#ws_js_external_library_downloaded_from_CDN) as well as [Node.js Core nodules](#ws_js_libraries_node_js_core) or any [custom third-party libraries](#ws_js_custom_third_party_library). ![External libraries node](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_external_libraries_node.png)

> **Note:**
> IntelliJ IDEA uses libraries only to enhance coding assistance (that is, code completion, syntax highlighting, navigation, and documentation lookup). Note that a library is not a way to manage your project dependencies.

## Download TypeScript community stubs (TypeScript definition files)

> **Tip:**
> TypeScript community stubs are also known as TypeScript definition files, or TypeScript declaration files, or DefinitelyTyped stubs, or just `d.ts` files.

In IntelliJ IDEA, [DefinitelyTyped stubs](https://github.com/DefinitelyTyped/DefinitelyTyped) can be configured and used as libraries, which is in particular helpful in the following cases:

* To improve code completion, resolve symbols for a library or a framework that is too sophisticated for IntelliJ IDEA static analysis, and add type information for such symbols.

* To resolve globally defined symbols from test frameworks.

The example below shows a piece of code from an Express application where the `post()` function is not resolved:

![Symbol not resolved without d.ts](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_node_express_symbols_not_resolved_without_d_ts.png)

IntelliJ IDEA successfully resolves `post()` after you install a TypeScript definition file:

![Symbol resolved after d.ts is installed](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_node_express_symbols_resolved_with_d_ts.png)

With IntelliJ IDEA lets you download TypeScript definition files right from the editor, using an intention action, or you can do it on the Settings: JavaScript Libraries page.

Procedure: Download TypeScript definitions using an intention action

* Place the caret at the `import` or `require` statement with this library or framework, press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)), and choose Install TypeScript definitions for better type information:

![Download TypeScript definitions intention action](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_download_ts_definitions_intention_action.png)

IntelliJ IDEA downloads the type definitions for the library and adds them to the list of libraries on the JavaScript. Libraries page:

![Type definitions library added to the list](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_download_ts_definitions_added_to_lib_list.png)

* Alternatively, open your `package.json`, place the caret at the package to download a type definition for, press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)), and select Install '@types/<package name>'.

![Install type definitions from package.json](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_download_ts_definitions_from_package_json.png)

Procedure: Download TypeScript definitions on the JavaScript Libraries page

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | JavaScript | Libraries`.

2. On the Libraries page that opens, click Download and in the Download Library dialog that opens, select the required library, and click Download and Install.

![Add TypeScript definition file](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_download_ts_community_stubs.png)

IntelliJ IDEA shows the downloaded type definitions in the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) , under the External Libraries node.

![Downloaded type definitions are shown under the External libraries node](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_download_ts_definitions_shown_in_external_libraries.png)

Procedure: Optionally

* IntelliJ IDEA enables the downloaded type definitions in the scope of the current project. You can change this scope as described in [Configuring the scope of a library](#ws_js_configuring_js_libs_change_scope) below. See also [Example: Configuring the scope for HTML and Node.js Core libraries](#ws_js_external_libraries_configuring_html_and_node_core).

## Configure Node.js Core library

To get code completion and reference resolution for [fs](https://nodejs.org/api/fs.html), [path](https://nodejs.org/api/path.html), [http](https://nodejs.org/api/http.html), and other core modules that are compiled into the Node.js binary, you need to configure the Node.js Core module sources as a JavaScript library.

Procedure:

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | JavaScript Runtime`.

2. Make sure that Node.js is selected in the Preferred runtime field.

3. Select the required Node.js installation from the Node.js runtime list.

4. Select the Coding assistance for Node.js checkbox.

Note that the Node.js Core library is version-specific. So if you change the version of your Node.js on the [JavaScript Runtimes](javascript-runtime.html) page, you need to select the checkbox again. After that IntelliJ IDEA creates a new library for this new version.

## Configure node_modules library

To provide code completion for project dependencies, IntelliJ IDEA creates a node_modules library automatically so Node.js modules are kept in your project but no inspections are run against them, which improves performance.

![node_modules library added to the list](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_node_modules_added_settings.png)

In the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) , the node_modules is also marked as a library:

![node_modules folder marked as library root.png](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_node_modules_marked_as_library_root.png)

However, the node_modules library contains only the modules that are listed in the `dependencies` object of your project `package.json` file. IntelliJ IDEA does not include the dependencies of dependencies into the node_modules library but actually excludes them from the project.

## Configure the scope of a library

From time to time you may notice that IntelliJ IDEA suggests irrelevant completion, for example, Node.js APIs in your client-side code. This happens because by default IntelliJ IDEA uses a library for completion in the entire project folder. IntelliJ IDEA lets you tune code completion by configuring scopes for libraries.

Procedure:

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | JavaScript | Libraries`.

The Libraries page shows a list of available libraries.

2. Clear the Enabled checkbox next to the required library, and click Manage Scopes.The [JavaScript
Libraries. Usage Scope](null) dialog opens.

3. In the JavaScript Libraries Usage Scopes dialog, click the Add button (![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg)) and select the files or folders that you want to include in the library scope. In the JavaScript Libraries Usage Scopes dialog, the Path field shows selected files or folders.

4. For each added file or a folder, from the Library list, select the library that you are configuring.

### Example: Configure the scope for HTML and Node.js Core libraries

When working on a full-stack JavaScript application in IntelliJ IDEA, you often notice that code completion suggests some Node.js API in your client-side code and DOM API in the Node.js code. This happens because the HTML library with DOM API and the Node.js Core library with Node.js API are by default enabled in the whole project. To get rid of irrelevant completion suggestions, you need to configure the scope for these libraries.

Procedure:

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | JavaScript | Libraries`.

The Libraries page shows a list of available libraries.

![Configure JavaScript libraries: a list of available libraries](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_html_node_libs.png)

2. Clear the  Enabled  checkboxes next to HTML and Node.js Core items.

![Clear Node.js Core and HTML](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_html_node_libs_enabled_cleared.png)

3. Click Manage Scopes. The JavaScript Libraries Usage Scopes dialog opens.

4. To configure the scope for the HTML library, click ![app.general.add.png](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg).

![Add scope for HTML](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_manage_scopes_add_scope_html.png)

In the dialog that opens, select the folders with the client-side code and click Open.

![Add scope for HTML: select folders](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_manage_scopes_html_add_folders.png)

You return to the JavaScript Libraries Usage Scopes dialog where the selected folders are added to the list.

![Manage Scopes dialog: folders for HTML library added](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_manage_scopes_html_folders_added.png)

From the Library list next to each folder, select HTML.

![Specify scope: HTML library selected](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_manage_scope_html_selected.png)

5. To configure the scope for the Node.js Core library, click  ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) again, add the folders with the server-side code, and for each of them select Node.js Core from the Libraries list.

![Specify scope: Node.js Core library selected](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_libs_manage_scope_node_core_selected.png)

Now IntelliJ IDEA resolves items from the HTML and Node.js Core libraries and suggests them in completion only in files from these chosen project folders.

In the same way, you can configure the scope of the automatically created node_modules library, refer to [Configuring node_modules library](#ws_js_libraries_examples_node_modules).

## Configure a library added via a CDN link

When a library `.js` file is referenced through a CDN link, it is available for the runtime but is invisible for IntelliJ IDEA. To add the objects from such library `.js` file to completion lists, download the file and configure it as an external library.

Procedure: Download a library

* Place the caret at the CDN link to the library, press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)), and choose Download library from the list:

![Intention action: download CDN library](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_download_from_cdn.png)

The library is downloaded to IntelliJ IDEA cache (but not into your project), and a popup with an information message appears:

![CDN library added](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_vue_added_popup.png)

On the JavaScript Libraries page, the downloaded library is added to the list:

![CDN library added to the list](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_vue_added.png)

In the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) , the library is shown under the External Libraries node:

![Downloaded CDN library is shown under the External Libraries node](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_download_from_cdn_show_in_project_view.png)

Procedure: Change the visibility of a library

* By default, IntelliJ IDEA marks the downloaded library as Global, which means that you can enable and re-use it in any other IntelliJ IDEA project. To change this default setting, select the downloaded library in the list, click Edit, and choose Project in the Edit Library dialog that opens.

![Configure the visibility of a library](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_change_visibility.png)

## Configure a custom third-party JavaScript library

Suppose you have a JavaScript framework file in your project or elsewhere on your machine, and you want IntelliJ IDEA to treat it as a library and not just as your project code that you edit.

Procedure:

1. Download the required framework file.

2. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | JavaScript | Libraries`.

3. On the  Libraries page, click Add.

4. In the New Library dialog, specify the name of the external JavaScript library.

5. Click the Add button (![app.general.add.png](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg)), and select Attach Files… or Attach Directories… from the list.

![Configure custom library: Add files/folders](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_add_custom.png)

In the file browser, select the file or folder with the downloaded framework.

![Configure custom library: library added](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_custom_library_added.png)

When you click OK, you return to the Libraries page where the new library is added to the list.

![The new custom library is added to the list](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_custom_library_on_the_list.png)

6. In the   Project tool window  (`Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))) , the library is shown under the External Libraries node.

![A custom library is shown under the external Libraries node](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_js_configure_libraries_custom_library_in_project_tool_window.png)

Procedure: Optionally

* By default, the library is enabled in the scope of the whole current project. You can change this default setting as described in [Configuring the scope of a library](#ws_js_configuring_js_libs_change_scope).

* In the Documentation URLs area, specify the path to the official documentation of the library or framework. IntelliJ IDEA will open this URL when you press `Shift+F1` (Windows), `⇧ F1` (macOS), `⇧ F1` (IntelliJ IDEA Classic (macOS)), `⇧ F1` (macOS System Shortcuts), `Shift+F1` (XWin), `Shift+F1` (GNOME), `Shift+F1` (KDE), `Shift+F1` (Emacs), `Shift+F1` (Sublime Text), `⇧ F1` (Sublime Text (macOS)), `Shift+F1` (NetBeans), `Shift+F1` (Visual Studio), `⇧ F1` (Visual Studio (macOS)), `Shift+F2` (Eclipse), `⇧ F2` (Eclipse (macOS)) on a symbol from this library.

## View the libraries associated with a file

Procedure:

* Open the file in the editor, press `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)), and select Use JavaScript Library from the list.

![View associated JS libraries: Find Action](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_view_associated_libraries_find_action.png)

IntelliJ IDEA displays a list with the available configured libraries. The libraries associated with the current file are marked with a tick.

![View associated JS libraries: popup list](https://resources.jetbrains.com.cn/help/img/idea/2026.2/ws_view_associated_libraries_list.png)

* To remove the current file from the scope of a library, clear the tick next to this library.

* To associate a library with the current file, set a tick next to this library.

## Delete a library

Procedure:

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | JavaScript | Libraries`.

The Libraries page displays a list of available libraries.

2. Select a library and click Remove.

## See also

### Procedures

[Quick Documentation](viewing-reference-information.html#inline-quick-documentation) [External documentation](viewing-reference-information.html#external-docs)

