This issue also bother me and then i find possible cases to reproduce this issue
When i run my computer os window as administrator user then it works fine with ng serve cmd but when switch to other user account like guest or other users then i got this issue.
So if i want to run my angular application with other user account (guest) then i need to run this command
npm run ng serve and which is working but when i run the command with arguments like --host or other npm run ng server --host 192.168.0.1 it's not working and throw some error
So i find some possible solutions these are:
1. Go appdata folder in your computer window os here is address of folder user\admin\AppData\Roaming\npm copy this path but if you use other user account (guest) user\guest\AppData\Roaming\npm (check with which accounts you logged in to your system then replace guest with the user name) folder you can copy this npm folder from admin user account and past it to guest user account because there is no data for npm. But you can also do this instead of previous step that is just copy the path of user\admin\AppData\Roaming\npm folder and then open your environment variable setting and add this path in path variable name
Enter this path in system path variable not user variable C:\Users\admin\AppData\Roaming\npm
and run the command prompt as administrator then run ng command it will work
Comments
Post a Comment