❗IMPORTANT: This extension has been deprecated. Support for running npm scripts is now provided by VS Code. You can run npm scripts as tasks using task auto detection or from the npm scripts explorer.
This extension supports running npm scripts defined in the package.json
file.
Commands for running scripts are available the npm
category.
- Run a script (
npm run-script
) defined in thepackage.json
by picking a script defined in thescripts
section of thepackage.json
. - Rerun the last npm script you have executed using this extension.
- Run npm install, also available in the context menu of the explorer when the
package.json
file - Terminate a running script
The scripts can be run either in the integrated terminal or an output window.
Support for Macbook Pro touch bar. You can run the following commands:
- npm install
- npm start
- npm test
- npm build
npm.runInTerminal
defines whether the command is run in a terminal window or whether the output form the command is shown in theOutput
window. The default is to show the output in the terminal.npm.includeDirectories
define additional directories that include apackage.json
.npm.useRootDirectory
define whether the root directory of the workspace should be ignored, the default isfalse
.npm.runSilent
run npm commands with the--silent
option, the default isfalse
.npm.bin
custom npm bin name, the default isnpm
.npm.enableTouchbar
Enable the npm scripts on macOS touchbar.npm.oldKeybindings.enable
Enable the original npm keybindings that start withcmd/ctrl R
{
"npm.runInTerminal": false,
"npm.includeDirectories": [
"subdir1/path",
"subdir2/path"
]
}
This extension originally defined a chording keyboard shortcut for the R
key. This has resulted in conflicts with the keybindings provided by VS Code and has caused frustration. To avoid these conflicts the keybindings have been changed to use the existing chording shortcut starting with the K
key. The following table shows the default key bindings that can always be changed, see the customization documentation.
Command | Old | New |
---|---|---|
Rerun last script | CMD+R R |
CMD+K L |
Select a script to run | CMD+R SHIFT+R |
CMD+K SHIFT+R |
Terminate the running script | CMD+R SHIFT+X |
CMD+K SHIFT+X |
Run the test script | CMD+R T |
CMD+K T |
If you prefer the old keybindings starting with R
you can define the setting npm.oldKeybindings.enable
to true
.