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
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.
Custom Shortbut
Then, we located the NodeJS Command Prompt shortcut ...
C:\Program Files\nodejs
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.
The TARGET here should be ...
C:\Windows\System32\cmd.exe /k "C:\Program Files\nodejs\nodevars.bat"
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 ...
Then, set is as default ...
Conclusion
This simple setup gave him much more flexibility without any hassles for Angular development using the CLI.
Top comments (1)
Yeah, that's simple and very useful. Thanks