'NPM scripts not shown in Explorer sidebar. How to shwo them again?

I have this problem with Visual Studio Code for Windows 10: I can't see anymore the NPM scripts in explorer sidebar.

I deleted all the extensions, uninstalled VS Code cancelling also its folder and the extension folders, installed latest version of VS Code again with no custom options and no extensions, but it didn't solved my problem; the NPM scripts menu does not appear.

How could I fix this so that the NPM Scripts menu option is shown again?



Solution 1:[1]

Few places to look for the NPM-Scripts explorer :

The npm-scripts explorer can be enabled or disabled with the below settings, in VSCode's settings.json:

"npm.enableScriptExplorer": false Default value is false, change to true and it should work. Try restarting VSCode for changes to take effect(although a restart is not often required) if it doesn't show up.

Another very hard to notice place is the three dots ... in the top right corner of your project explorer (verify if NPM scripts is checked). This is something which I had experienced personally for a different extension.

enter image description here

Solution 2:[2]

  1. Open "File > Preferences > Settings"
  2. Search "npm script"
  3. Toggle "Npm: Enable Script Explorer"
  4. Close VSCode; reopen

enter image description here

Solution 3:[3]

Appreciate I may be a bit late to answer this question. For me, this was due to npm scripts not being selected to display in explorer. Once I had selected the box, the npm scripts window was available to view.

Visual description for enabling npm scripts window in VS code

Solution 4:[4]

Hopefully, this has just been fixed - see https://github.com/microsoft/vscode/issues/120279#event-4631666095 and https://github.com/microsoft/vscode/issues/120279#issuecomment-824950294 seeking test verification.


It is in the Insiders now and in Stable early May, 2021. It fixed it for me.


View/Open View...
Type NPM
Click on NPM Scripts

If it still isn't working, see https://github.com/microsoft/vscode/issues/119868

Is your package.json at the root level? Does it make any difference if you open your package.json first, and then check for the view? Or try opening another .json file (or even the Release Notes has been reported as working) and then do a Reload. Otherwise, add your info to the issue.

Solution 5:[5]

Version 1.59.1

Go to View -> Open View and type: npm scripts:

enter image description here

Solution 6:[6]

Try to delete package-lock.json and restart VSCode. In my case it worked.

Solution 7:[7]

Work around: If I leave an editor tab open with my package.json (I have one in the root, and in two other places), close and re-open VSC, then it seems to 'find' the NPM View.


TL;DR; My VSC (1.55.2) is inconsistently showing / not showing the NPM View.

When it starts without the view, I cannot use View->Open "npm". No option in Explorer options (...)

When it starts with the view, View->Open has a result for "npm". Has option in Explorer options (...)

Bug report here: https://github.com/microsoft/vscode/issues/120279

Solution 8:[8]

It happens to me sometimes when I open VSCODE. Whenever it happens I simply load a package.json file. The NPM SCRIPTS menu still appears when I close the package.json file.

If that doesn't do the trick, try installing NPM-Scripts extension.

Solution 9:[9]

If it worked normally before but now it does not, and you have the extension installed and enabled. Then all you have to do is open your package.json file and it will be available again.

I guess this weird behavior happens when you disable all your extensions or may happen if you're installing/removing extensions from a remote container

Solution 10:[10]

You can install NPM-Scripts extension which does the same as npm scripts functionality which was build into vscode.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Asif Kamran Malick
Solution 2 elegentin
Solution 3 Martyn93
Solution 4
Solution 5 Sebastian
Solution 6 Pihail
Solution 7
Solution 8
Solution 9 Karmavil
Solution 10 Viachaslau Taldykin