I was thinking , would it be helpful and efficient to get a notification(sound or popup) back after npm finish running a task , a long installation for example . I'm using vscode and running most of my command in the integrated terminal and while waiting for it to finish I ended up spending more time on doing other task that is non-productive.
-
1Perhaps `npm install; [search on how to make a sound from bash]`, e.g. [this](https://stackoverflow.com/questions/1143386/in-a-bash-script-command-how-can-i-make-a-pc-beep-noise-or-play-a-sound-file) - `;` instead of `&&` since you may want an alert even if it fails. – Jeppe Jan 24 '20 at 08:30
5 Answers
So we can break this down to running npm install
, followed by some way of making a sound. According to this thread, a simple beep can be done using:
echo -en "\007"
.
Combine these two, and you get:
npm install; echo -en "\007"
The use of ;
ensures that the beep is played even if npm install
fails (as opposed to &&
which only runs the beep if the first command is successful). You could also look here for how to start playing a song with VLC: play-only-audio-with-vlc

- 1,830
- 3
- 24
- 33
-
Can we add this such that it is executed after every `npm install` ? Like a global `postinstall` script. – Abhijit Apr 07 '21 at 10:20
-
1Unless supported by `npm`, I doubt it is possible. You could create an alias in that case. – Jeppe Apr 08 '21 at 19:44
-
If your npm install
is part of a task, VSCode 1.72 (Sept. 2022) will offer:
add audio cue for task end and terminal bell
Settings
audioCues.taskEnded
This has been released to VSCode Insiders yesterday.

- 1,262,500
- 529
- 4,410
- 5,250
For a slightly different solution there is a npm package named benny-hill:
Play the Benny Hill theme while running another command
e.g.
npx benny-hill npm install
will play Yakety Sax while you're waiting.

- 26,565
- 10
- 94
- 165
for cmd like Terminals
Your_Command && [System.Media.SystemSounds]::Beep.Play()
Sounds: Beep, Hand, Quetsion, Asterisk, Exclamation
You can also play the raw sound and changes its pitch and duration [console]::beep(1000,500)

- 1,380
- 1
- 11
- 29
Actually there is a npm package doing exactly what you are asking for:
Literally tells you when a command is done running.
E.g.
npx okimdone npm install
It depends on external speech to text tools like espeak or festival to produce the audio.

- 26,565
- 10
- 94
- 165