I encountered a problem installing then running yeoman. I've concluded that I shouldn't have installed all npm packages with sudo, but I didn't know how else to install them globally. So I got this error:
sudo yo python-generator /usr/local/lib/node_modules/yo/node_modules/configstore/index.js:53 throw err; ^ Error: EACCES: permission denied, open '/home/me/.config/configstore/insight-yo.json' You don't have access to this file. at Object.fs.openSync (fs.js:584:18) at Object.fs.readFileSync (fs.js:491:33) at Configstore.get (/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:34:26) at Configstore (/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:27:44) at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:37:34) at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:172:11) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12)
When checking the ownership of the files in the configstore directory:
sudo ls -l /usr/local/lib/node_modules/configstore/ total 20 -rw-r--r-- 1 nobody me 2409 Feb 13 13:19 index.js drwxr-xr-x 14 root root 4096 Apr 29 10:54 node_modules -rw-r--r-- 1 nobody me 5359 Apr 29 10:54 package.json -rw-r--r-- 1 nobody me 2178 Feb 13 13:19 readme.md
Apparently they’re owned by nobody. So I ran
sudo chown -R $USER /usr/local. Now I can only install npm packages globally “without” sudo. Root can't install npm packages anymore.
I can't give ownership back to root for any of the directories it owned. What kind of implications will this have? I saw someone on another forum solve the same problem, but they created a new user, and used edited visudo to give it superuser privileges. It wasn't so clear but it seems he gave ownership of
/usr/local to this new user. I didn't understand the reasoning behind giving ownership to a new user.
Is the idea to create a new user with a really strong password, turn it into something similar to root, then give this user ownership to the directories, and never log in to that new user again?
The ambiguous part is who this $USER is. Is it matheas? If so, why does he have to rewrite the ownership of that users home directory? I'm pretty confused. But I'm concerned of the implications of now owning the whole /usr/local directory.