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

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?



Solution 1:[1]

Run:

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

Resolved the issue for me.

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

Thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tan js