If you are using a MAC system or a Unix / Lunix machine, you just need to know what for security, even if your root owner must use the sudo command in the line command in the terminal. Therefore, changing ownership of files and directories is not enough to execute the chown command most of the time.
The reason is that the command you execute will have big changes in the system files, and you need to enter the password of your root administrator, as in Windows, when they ask you to enter the administrator password for system changes, so it will look like this:
* Ms-MacBook-Pro: ~ AMB $ sudo npm install -g express-generator
Password: (ENTER PASSWORD FOR ROOT / ADMINISTRATOR)
/usr/local/bin/express -> /usr/local/lib/node_modules/express-generator/bin/express-cli.js /usr/local/lib └─┬ express-generator@4.15.0 ├─┬ commander@2.9.0 │ └── graceful-readlink@1.0.1 ├── ejs@2.5.6 ├─┬ mkdirp@0.5.1 │ └── minimist@0.0.8 └── sorted-object@2.0.1
Ms-MacBook-Pro: ~ AMB $ *
source share