Issue with Yo Generator on MEAN One-Click Install Image

Posted October 28, 2014 12.4k views

One of the main parts of Mean.js that goes with “MEAN One-Click Install Image” is “Yo Generator”

Have tested installing it with and without sudo but always end up with this

root@NodeJS2:/opt/test# yo meanjs

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

    at Object.fs.openSync (evalmachine.<anonymous>:438:18)
    at Object.fs.readFileSync (evalmachine.<anonymous>:289:15)
    at Object.create.all.get (/usr/local/lib/node_modules/yo/node_modules/configstore/configstore.js:33:29)
    at Object.Configstore (/usr/local/lib/node_modules/yo/node_modules/configstore/configstore.js:26:44)
    at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:26:34)
    at Object.<anonymous> (/usr/local/lib/node_modules/yo/cli.js:123:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

Here is install instructions

Have tested several suggestions of fixes for this but can’t get it to work so i hope someone have a solution for this that really works.

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

yo was designed to not run as root/sudo

You need to create a user to run this as, place it in their home folder, change ownership to them, then try again.

  • Did create a new user, installed NPM with it and then did run Yo meanjs and this time it did go a bit better but still not ending up working.

    You're using the official MEAN.JS generator.
    ? What would you like to call your application? MEAN
    ? How would you describe your application? Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js
    ? How would you describe your application in comma seperated key words? MongoDB, Express, AngularJS, Node.js
    ? What is your company/author name?
    ? Would you like to generate the article example CRUD module? Yes
    ? Which AngularJS modules would you like to include? ngCookies, ngAnimate, ngTouch, ngSanitize
                        throw err0;
    Error: EACCES, permission denied '/opt/yotest/app'
        at Object.fs.mkdirSync (fs.js:653:18)
        at Function.sync (/usr/local/lib/node_modules/generator-meanjs/node_modules/yeoman-generator/node_modules/mkdirp/index.js:70:13)
        at yeoman.generators.Base.extend.copyApplicationFolder (/usr/local/lib/node_modules/generator-meanjs/app/index.js:105:8)
        at /usr/local/lib/node_modules/generator-meanjs/node_modules/yeoman-generator/lib/base.js:395:14
        at processImmediate [as _immediateCallback] (timers.js:345:15)
  • Have you given ownership to the user for the directory “/opt/yotest” and all files/folders within?

  • Got it to work now, this was my steps to do it, maybe some of them was unneeded

    create a new user ‘mathias’ and in sudo /usr/sbin/visudo set all privileges

    sudo chown -R $USER /usr/local

    After this i could install NPM with current user.

    To be able to runt yo meanjs is needed to set folder permission like

    sudo chown -R $USER /opt/yotest

    Now it was possible to get all the files but still got error thrown trying tu run $grunt or $npm install that was regarding permission rights at /home/mathias/****

    sudo chown -R $USER /home/mathias

    Solved this and i was able to get it running.

    Do you know if 'mathias’ in this command could be changed for $user instead to make it global ?

    sudo chown -R $USER /home/mathias  
    sudo chown -R $USER /home/%user  

    I will shorten this up to exact steps and put up tut for others because it’s really confusing to get it to work and none of the answers that will come up searching on the initial error will be the solution.

  • Yes, you can use $user in its stead, if the home folder for that user is what you are wishing to use.


    user andy has a yo app that you want him use. You would log on as him, and run:

    sudo chown -R $USER /home/$USER

    That should do it.