Skip to content

Guide · Open source

How to use Inquirer.js: install it and ask terminal questions

Updated · written with AI from the project's own documentation and checked against our catalogue data

Inquirer.js is a collection of common interactive command line user interfaces for Node.js. It lets a terminal program ask the user questions such as free text input, yes/no confirmations, selection lists and checkboxes, so you do not have to handle raw terminal input yourself. This guide covers what the library is for, how to install it with npm, and how to decide whether it fits your project.

Inquirer.jsSBoudrias/Inquirer.js · ★ 21.6k · MIT

Quick start

  1. 1Confirm Node.js is installed. Inquirer.js requires Node.js, so make sure it is available in the environment where your command-line tool runs.
  2. 2Install the package. Run npm install inquirer in your project folder to add the library.
  3. 3Read the full README. Open the complete README in the repository, since the provided copy is truncated and lacks usage details.
  4. 4Define your prompts. Write the questions your tool needs, choosing from text input, confirmations, lists and checkboxes as described in the full documentation.
  5. 5Test in the terminal. Run your command-line program and answer the prompts to check the flow before you ship it.

What Inquirer.js does

Inquirer.js is a TypeScript and JavaScript library for command-line programs that run on Node.js. It is designed for prompts inside the terminal: a program asks a question, the user answers, and the program continues based on the reply.

The prompt types described in the project summary are text input, yes/no confirmations, selection lists and checkboxes. Developers commonly use these to build setup wizards and interactive CLI tools.

  • Text input for free-form answers
  • Yes/no confirmations
  • Selection lists
  • Checkboxes for picking several options

Who should use Inquirer.js

Inquirer.js suits Node.js developers building interactive command-line tools, authors of project scaffolding or setup wizards that ask several questions in a row, and TypeScript developers who want typed prompt definitions. It is also a fit for teams that want a maintained, widely used prompt library under the MIT license.

  • Node.js developers building interactive command-line tools
  • Authors of scaffolding or setup wizards
  • TypeScript developers who want typed prompt definitions
  • Teams that want an MIT-licensed, widely used prompt library

Install Inquirer.js with npm

The only prerequisite named in the source is Node.js. Install the inquirer package from your project folder with npm using the command below.

npm install inquirer

Know what the README covers

The README provided for this summary is truncated, so this guide does not list API calls, options or examples beyond what the project description states. For exact prompt definitions and usage code, read the full README in the project repository, which is under packages/prompts/README.md in the source material.

Check the limits before you start

Inquirer.js targets the terminal. It is not a tool for prompts in a browser or web UI. It is built for Node.js, so it does not fit projects that need non-Node.js runtimes. It is also a library to embed in your own program, not a ready-made end-user application.

  • Not for browser or web UI prompts
  • Not for non-Node.js runtimes
  • Not a ready-made end-user application

Compare Inquirer.js with similar projects

The project summary lists enquirer, prompts, clack and commander as comparable projects. Each has its own scope and API, so compare them against your needs for prompt types, TypeScript support and licence before choosing. The summary does not provide a detailed comparison or benchmarks.

  • enquirer
  • prompts
  • clack
  • commander

What people use it for

  • Setup wizards that ask a series of questions before generating files
  • Project scaffolding tools that offer choices from a list
  • Command-line tools that confirm risky actions with a yes/no prompt
  • TypeScript CLI tools that want typed prompt definitions

Frequently asked questions

How do I install Inquirer.js?

Install the inquirer package with npm by running npm install inquirer in your project folder. The source names Node.js as the prerequisite.

Is Inquirer.js free to use?

Inquirer.js is licensed under the MIT license, as stated in the project information. Check the license file in the repository for the full terms.

What do I need to run Inquirer.js?

You need Node.js. Inquirer.js is a library for Node.js command-line programs, so it does not run in a browser.

Can Inquirer.js make prompts for a web page?

No. Inquirer.js targets the terminal, so it is not suited to browser or web UI prompts.

What are alternatives to Inquirer.js?

The project summary lists enquirer, prompts, clack and commander as comparable projects. Compare their scope, prompt types and licence against your needs.

Why does the guide not show detailed code?

The README provided is truncated, so this guide only uses the install command and the features it describes. Use the full README in the repository for usage examples.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Inquirer.js is a good choice for Node.js developers and teams who need a maintained, MIT-licensed library for terminal questions, including TypeScript projects with typed prompts. If you need browser prompts, a non-Node.js runtime, or a finished end-user app, pick something else. Read the full README before you build, because the provided copy is truncated.

Install options & downloads