Setup develop environment fail at 'bin/setup'


#1

Hi all,
I follow the Developer Guild prepare environment

But, I failed at “bin/setup” step

The Error Message:

== Migrating database ==
/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:54
                                throw err;
                                ^

Error: EACCES: permission denied, open '/home/milk/.config/configstore/bower-github.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/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:35:26)
    at Object.Configstore (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:28:44)
    at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:19:23)
    at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:16:32)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

== bower install failed ==

== Command ["bundle exec rake update:bower"] failed ==

The bower-github.json’ file actual doesn’t exist

~/rails/manageiq$ sudo ls /home/milk/.config/configstore/bower-github.json
ls: cannot access '/home/milk/.config/configstore/bower-github.json': No such file or directory

How to fix it ?


#2

The problem is that npm install -g (or yarn global add) need to write to system directories if you’re using system version of node js.

If you’re OK with that, there’s nothing wrong with doing so, you’ll just need to run any npm install -g ... under sudo.

If you’d prefer an alternative, you can install nvm (https://github.com/creationix/nvm), which makes a user-local nodejs install, and then everything should work as expected :).


#3

Oh! sorry I misread … the problem is in your home, with .config, not with installing globally, right?

I would assume you have at some point ran bower under sudo. That’s never a good idea :).

The problem is not with .config/configstore/bower-github.json having the wrong access, but with .config/ or .config/configstore. One of those directories is probably owned by root now, which you don’t want.


#4

Thanks @himdel.

I chown the configstore folder, the bin/setup run without issue.

Does the Develop doc need to modify without “sudo” at npm install xxx ?

* Install the Bower and Yarn package manager
sudo npm install -g npm
sudo npm install -g bower yarn
* Install the Gulp and Webpack build system
sudo npm install -g gulp-cli
sudo npm install -g webpack

#5

Aah, good to hear :).

Does the Develop doc need to modify without “sudo” at npm install xxx ?

I don’t think so, sudo npm install -g .. should never have caused this, and there’s no sudo bower install ... in there.

Though we may want to add a section about nvm or even recommend it by default for devel setups (and drop the sudo then :)).


#6

sudo npm install -g bower yarn

That line is currently only under “Ubuntu / Debian” section. I think it’s worth to also update “Fedora /CentOS 7” and “Mac” sections to include it.

I just updated code from the repo and I was getting a “== yarn failed ==” message when doing either bin/update and bin/setup. Then, I came to this thread and found that yarn needs to be installed.


#7

:+1: thanks, you’re right

Fixed in https://github.com/ManageIQ/guides/pull/233