Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 533
YellowBlue Avatar asked Apr 04 '21 17:04

YellowBlue


People also ask

How do I list npm scripts?

Listing the scripts available in a package. json file is easy: just go to the root directory of your project and type npm run in the terminal. Then run the ntl command in the project folder. You'll get a list of available scripts, with the option of selecting one of them to run.

Where do I put npm scripts?

Using the NPM (Node Package Manager) scripts is also simple. To define an NPM script, set its name and write the script under the 'scripts' property of your package. json file: To execute your Script, use the 'npm run <NAME-OF-YOUR-SCRIPT>' command.

How do I run a script after npm install?

You can easily run scripts using npm by adding them to the "scripts" field in package. json and run them with npm run <script-name> . Run npm run to see available scripts. Binaries of locally install packages are made available in the PATH , so you can run them by name instead of pointing to node_modules/.

Why npm install is not working in VS code?

If you're calling npm from the VSCode terminal, you need to restart VSCode first before trying again. If you still get the error, then try restarting your computer first. The error should be gone after you restart. Now you should be able to install any npm package to your local computer with npm install command.


2 Answers

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

like image 73
Asif Kamran Malick Avatar answered Sep 21 '22 18:09

Asif Kamran Malick


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

enter image description here

like image 30
elegentin Avatar answered Sep 21 '22 18:09

elegentin