Search code examples
node.jsyeomanyeoman-generatorkeystonejs

error installing yeoman on debian jessie


I am using a fresh install of Debian 8 Jessie. I installed Nginx, Nodejs 4x,NPM,and MongoDB. I attempted to install Yeoman with npm install -g yo. I pressed enter to output yo-complete to STDOUT. I then ran yo-complete. Next i installed npm install -g generator-keystone. When i try to use the generator yo keystone in a project i get the following error message:

/usr/lib/node_modules/yo/node_modules/configstore/index.js:53
                                throw err;
                                ^

Error: EACCES: permission denied, open '/root/.config/configstore/insight-yo.json'
You don't have access to this file.

    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Object.create.all.get (/usr/lib/node_modules/yo/node_modules/configstore/index.js:34:26)
    at Object.Configstore (/usr/lib/node_modules/yo/node_modules/configstore/index.js:27:44)
    at new Insight (/usr/lib/node_modules/yo/node_modules/insight/lib/index.js:37:34)
    at Object.<anonymous> (/usr/lib/node_modules/yo/lib/cli.js:163:11)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)

FYI, I am logged in as root, but i understand the problem is that npm runs as no user/group. I never had this problem on ubuntu, but for whatever reason i'm having it now on Jessie. I am at a loss for where i should start in trying to resolve this issue.


Solution

  • As it turns out, my issue was being logged in as root.

    i did the following steps:

    1. apt-get autoremove nodejs
    2. adduser dev fill out user details in prompt
    3. visudo and uncomment the line allowing sudo group to execute commands as root.
    4. usermod -aG sudo dev add user to sudo group
    5. su - dev switch to dev user
    6. sudo apt install nodejs
    7. sudo npm install -g npm to update npm
    8. sudo npm install -g yo reinstall yo
    9. install your generators

    Worked like a charm, Yo is working with no problems now.