'standard' is not recognized as an internal or external command

Viewed 2822

I want to integrate some kind of code linting for node.js in webstorm so I installed standard to my node.js project using:

npm instal standard --save-dev

It was installed and listed in the "devDependencies" section of package.json but when I run the command:

standard

in the console I get

'standard' is not recognized as an internal or external command
3 Answers

The scripts are in node_modules\.bin.

So, either:

  1. Add this to PATH before running standard, e.g.:

    set PATH=%PATH%;node_modules\.bin
    
  2. Run it in using node_modules\.bin\standard

  3. Use @tarek's approach using package.json: https://stackoverflow.com/a/49026837/122441

 "scripts": {

    "test": "standard middlewares/validations.js"
  }
  1. Add above lines in package.json.
  2. Here middlewares/validations.js is the path of the file to check.
  3. Run -> npm test
  4. If this file have any error you will get.
Related