playwrightplaywright-bddbddgen

Can't run bddgen getting "please install playwright-bdd"


I'm trying to use the bddgen CLI tool from the playwright-bdd package by running

npx bddgen

However, I keep getting this error:

To get "bddgen" CLI please install "playwright-bdd" package:
npm install -D playwright-bdd

Even though I already installed it with:

npm install -D playwright-bdd

Solution

  • I fixed the issue by manually removing the related binaries and packages, then reinstalling everything cleanly.

    rm -rf node_modules/playwright-bdd/ \
           node_modules/playwright/ \
           node_modules/playwright-core \
           node_modules/.bin/playwright \
           node_modules/.bin/bddgen \
           node_modules/.bin/playwright-core
           
    npm install -D playwright playwright-bdd
    

    This cleared up any broken or cached binaries, and after that npx bddgen worked as expected.

    Worst case, you can always try to remove node_modules and re-install everything.