If you want to install new node modules as a user, give permission.
- before giving permission to directory, check directory location
$ sudo chown -R $(whoami) ~/.npm
$ sudo chown -R $(whoami) /usr/local/lib/node_modules
- give permission for node_module to write in
node_modules
directory
https://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo