node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



alert for Node.

  • Uses window.alert in the browser.
  • Uses zenity, yad, notify-send, xmessage, dialog, or whiptail on Linux and BSD (depending on what's available).
  • Uses osascript/System Events on Mac.
  • Uses cscript on Windows (or msg if cscript fails).
  • Defaults to console.log.


npm i -S alert-node


import alert from 'alert-node'

If using the API, you can specify a program to use. This can be one of:

  • zenity (Linux)
  • yad (Linux)
  • notify-send (Linux)
  • xmessage (Linux)
  • dialog (Linux)
  • whiptail (Linux)
  • osascript (Mac)
  • cscript (Windows)
  • msg (Windows)
  • console (console.log)
  • window (window.alert)

Note that this will override any internal checks to get the correct program, and will blow up if you get it wrong. It's advised to just use the default behavior.

import alert from 'alert-node'
alert('hey!', 'yad')

alert-node also has a cli. npm i -g alert-node and run alert 'sup brah'.

License: MIT