PhpStorm 2017.2 Help

JavaScript

With PhpStorm, you can develop modern web, mobile, and desktop applications with JavaScript and Node.js. PhpStorm supports JavaScript and TypeScript programming languages, React and Angular frameworks and provides tight integration with various tools for web development.

On this page:

Prerequisites

Before you start working with JavaScript, make sure that the JavaScript Support plugin is enabled. The plugin is bundled with PhpStorm and is activated by default. If the plugin is not activated, enable it on the Plugins page of the Settings / Preferences Dialog as described in Enabling and Disabling Plugins.

JavaScript support

JavaScript files are marked with /help/img/idea/2017.2/viewAsJSON.png icon. JavaScript support in PhpStorm includes:

Developing an application that contains JavaScript: general overview

Developing an application that contains JavaScript, generally, includes performing the following steps:

  1. Create a project to implement your application.
  2. On the JavaScript page of the Settings dialog box, choose the JavaScript language version that you are going to use in your project.
  3. Install the project dependencies via the Node Package Manager by doing one of the following:
      1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PhpStorm | Preferences for macOS, and click Node.js and NPM under Languages & Frameworks.
      2. On the Node.js and NPM page that opens, the Packages area shows all the Node.js-dependent packages that are currently installed on your computer, both at the global and at the project level. Click /help/img/idea/2017.2/new.png.
      3. In the Available Packages dialog box that opens, select the required package.
      4. Optionally specify the product version and click Install Package to start installation.
    • Right-click the package.json file in the editor or in the Project tool window and choose Run 'npm install' on the context menu.
    • Open the built-in Terminal (View | Tool Windows | Terminal) and run the npm install <required_package> commands.
    • Install the required packages on the Node.js and NPM page of the Settings / Preferences Dialog.

    For details, see NPM.

  4. Populate the project. Use the following PhpStorm facilities, where applicable:
  5. Improve the quality and maintainability of your code using various types of refactorings, built-in code quality tools, and integration with other linters, see JavaScript Linters.
  6. Run your application by opening its starting HTML page in the PhpStorm default browser.
  7. Debug your application in the Google Chrome browser.

    The JavaScript debugging functionality is incorporated in PhpStorm, so just configure the debugger, whereupon you can start the debugging session and proceed as usual: set the breakpoints, step through them, stop and resume the program, and examine it when suspended.

In this section

Last modified: 12 October 2017

See Also

Language and Framework-Specific Guidelines: