DEV Community

Cover image for Windows, Angular CLI, and NodeJS
bob.ts
bob.ts

Posted on • Edited on

Windows, Angular CLI, and NodeJS

I recently had the honor of working with a neighbor beginning his development journey. He is taking a course through his employer and using a work computer with Windows installed.

Initially, I saw that he was using Git Bash ... mostly unsuccessfully. In particular, the Angular CLI was failing with command not found. He apparently had figured out some creative npx commands.

I wanted something simpler for him.

Knowing he had NodeJS installed, we set the path to the Angular CLI and made a custom shortcut to the NodeJS Command Prompt.

Setting the Path

We followed the rabbit hole and found the Angular CLI in the following location ...



C:\Users\<username>\AppData\Roaming\npm\node_modules\@angular\cli


Enter fullscreen mode Exit fullscreen mode

Then, we opened the Environment Variables and added this to the Path. This ensures that we are able to reference the CLI in the command prompt later.

Windows Environment Variables

Windows Environment Variables - New

Custom Shortbut

Then, we located the NodeJS Command Prompt shortcut ...



C:\Program Files\nodejs


Enter fullscreen mode Exit fullscreen mode

We then copied the shortcut and placed it on the desktop to make things a bit easier.

The biggest change we made to the shortcut was to set the "Start In" folder to the root of his projects folder ... we got to these settings by Right-Clicking and selecting Properties.

NodeJS Command Prompt Properties

The TARGET here should be ...



C:\Windows\System32\cmd.exe /k "C:\Program Files\nodejs\nodevars.bat"

Enter fullscreen mode Exit fullscreen mode




Windows 11

The previous information works for Windows 10 and Windows 11. However, I've used the newer terminal settings to add a profile. These images have everything I think you need.

Add the prompt to the list ...

Image description

Then, set is as default ...

Image description

Conclusion

This simple setup gave him much more flexibility without any hassles for Angular development using the CLI.

Top comments (1)

Collapse
 
fashion86 profile image
Fashion86

Yeah, that's simple and very useful. Thanks