Allure report generation fails with message ''allure' is not recognized as the name of a cmdlet, function..'

19.8k Views Asked by At

I am using Allure report for my WebDriverIO mocha test automation. Report generation was working fine however, it started showing below error while running 'allure generate allure-result' command.

allure : The term 'allure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

  • allure genertae
  • CategoryInfo : ObjectNotFound: (allure:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException```

This is my package.json devDependencies

 "devDependencies": {
        "@wdio/allure-reporter": "^7.16.11",
        "@wdio/cli": "^7.16.13",
        "@wdio/local-runner": "^7.16.13",
        "@wdio/mocha-framework": "^7.16.13",
        "@wdio/spec-reporter": "^7.16.13",
        "chromedriver": "^97.0.2",
        "mocha-allure-reporter": "^1.4.0",
        "wdio-chromedriver-service": "^7.2.6"
    },

What could be the reason for this failure and how to handle it?

2

There are 2 best solutions below

0
tan js On

Run:

npm install -g allure-commandline --save-dev

Resolved the issue for me.

Reference: https://www.npmjs.com/package/allure-commandline

Thanks

0
hariteja chintakunta On

There are 2 ways this could be rectified

The first method works reliably.

Run these 2 commands in Powershell to install scoop

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

now once that is done run other command which installs allure

scoop install allure

now check version of allure using allure --version

enter image description here

The second method is to check the environment variables and PATH for allure reports, to see if it is present or not