Error: EACCES, permission denied #1292

Closed
landed1 opened this Issue Feb 24, 2014 · 8 comments

Projects

None yet

6 participants

@landed1
landed1 commented Feb 24, 2014

I had to run as SUDO to install yeoman via the npm install -g yo command

then ran into this error when trying to do a search for angular or infact do anything using

yo search angular for example

When using with SU I get the following advice "please spend a few minutes learning more about how your system should work
and make any necessary repairs"

But I need a bit more help so am posting here. I did try adding /usr/local/npm/bin to etc/paths file and no change still has issues.

Thank You All -

DEBUG as requested in your guidelines

...calvin$ yo --version && echo $PATH $NODE_PATH && node -e 'console.log(process.platform, process.versions)' && cat Gruntfile.js

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

at Object.fs.openSync (fs.js:413:18)
at Object.fs.writeFileSync (fs.js:952:15)
at Object.create.all.set (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:55:8)
at Object.Configstore (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:18:11)
at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/insight.js:23:34)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/cli.js:23: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)
@fidel-karsto

Here is an excellent post of Sindre Sorhus on how to setup your global node modules to avoid the need of the sudo command. https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo-linux.md
The common behaviour for npm is to install global modules under /usr/lib/node_modules, which needs root level to be executed.
Sindres fix is to configure npm to use a directory with user rights (e.g. somewhere under your home directory).

@landed1
landed1 commented Feb 24, 2014

Is it the top one here https://gist.github.com/isaacs/579814
that looks like it makes 2 directories in the $HOME location I am trying it now am getting some red warning as the last make install is running...feeling a bit out of my depth again with build systems when I just want to make stuff work in js and angular - I'm just saying this is hardly a 'clean method' and I wonder just how much I am going to gain in the end.

still same error and I couldn't run the final curl command -

bash-3.2# curl https://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 175 0 0:00:01 0:00:01 --:--:-- 175
sh: line 1: html: No such file or directory
sh: line 2: syntax error near unexpected token <' 'h: line 2:<title>301 Moved Permanently</title>

@landed1
landed1 commented Feb 24, 2014

I eventually downloaded install.sh and ran that direct from my $HOME spot - I seem to be able to run node (i get a '>' prompt...) and npm (guide on useage) but yo still has this error.

@landed1
landed1 commented Feb 24, 2014

Ok I got it working sometimes just checking the error oneself is best ! The clue is there...

chown yourusername insight-yo.yml when in the directory that is prolly

/Users/yourusername/.config/configstore/

or I think
chown yourusername ~/Users/yourusername/.config/configstore/insight-yo.yml

might work.

@landed1 landed1 closed this Feb 24, 2014
@satishagarwal90

If the above methods don't work try deleting all files in the /Users/yourusername/.config/configstore/ directory and then run the yo command as usual.

@nickjuntilla

Thanks changing the permissions on .config and .npm in my user root directory worked. For the record it isn't just inconvenient and contradictory that all directions are wrong. You install NPM and then yeoman globally and then use it and it doesn't work. Not only doesn't it work, but it laughs at you and tells you that you are doing it wrong. This is everything that is wrong with computer 'science.'

@Munter
Munter commented Aug 8, 2014

@worldnick Install node with nvm as your local user and you won't have these problems.

@briantheuma

THANKS! ... @satishagarwal90. Your solution worked for me.

@sindresorhus sindresorhus locked and limited conversation to collaborators Aug 26, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.