npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Change npm's Default Directory - seems to "forget" system variables

I have followed the easy to follow instructions on how to How to Prevent Permissions Errors but I still somehow manage to screw it up.

… So after the 5 steps I run a test $ npm install -g @angular/cli and it installs correctly:

$ npm list -g --depth=0

└── @angular/cli@6.2.1

$ ng -v

Angular CLI: 6.2.1
Node: 10.10.0
OS: darwin x64
Package                      Version
@angular-devkit/architect    0.8.1
@angular-devkit/core         0.8.1
@angular-devkit/schematics   0.8.1
@schematics/angular          0.8.1
@schematics/update           0.8.1
rxjs                         6.2.2
typescript                   2.9.2

And now to weird parts.

When I close my window or open the integrated terminal in VSCode and run

$ ng -v

zsh: command not found: ng 

I have to repeat step 4 source ~/.profile every time I open a new terminal for it work as if it forgets my system variables?

What am I missing here? :)