'Command nest is not recognized

I installed nestjs cli globally via npm command.

npm i -g @nestjs/cli

Installation was successful, but when I am trying to create new project via cli using the command nest new project-name it says: 'nest' is not recognized as cmdlet name. So I used:

npx @nestjs/cli new project-name

this works but I continue having problems with commands nest in cli. I tried create a module using: nest g module module-name and having the same problem "the term 'nest' is not recognized. I tried to use npx @nestjs/cli instead nest just as for creating a new project but didn't work.



Solution 1:[1]

  1. On the Windows desktop, right-click My Computer.
  2. In the pop-up menu, click Properties.
  3. In the System Properties window, click the Advanced tab, and then click Environment Variables.
  4. In the System Variables window, highlight Path, and click Edit.
  5. Type npm root -g in your cmd.you get your root pakages path.
  6. Add C:\Users\Shahiq Shehzad\AppData\Roaming\npm in your Environment Variable ignore last node_modules
  7. Refresh Cmd
  8. Thanks

Refresh cmd 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 copoo