1

I'm trying to get into using my terminal on a mac. I installed npm sucessfully and when I type npm --version it gives me 2.14.12. With npm I installed bower and I think it worked. But I have two questions:

  1. when I type bower -v it gives me this:

            /usr/local/lib/node_modules/bower/node_modules/configstore/index.js:56
        throw err;
        ^
    
     Error: EACCES: permission denied, open '/Users/philip/.config/configstore/bower-  github.yml'
    You don't have access to this file.
    
     at Error (native)
    at Object.fs.openSync (evalmachine.<anonymous>:549:18)
     at Object.fs.readFileSync (evalmachine.<anonymous>:397:15)
     at Object.create.all.get (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:34:29)
     at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:27: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:435:26)
      at Object.Module._extensions..js (module.js:442:10)
    

but when I type sudo bower -vit works and gives me 1.7.2 after I typed in my password. Why doesn't it work without sudo?

  1. I wanted to install bootstrap 4 in a folder on my desktop so with cd I went to the directory and typed bower install bootstrap#v4.0.0-alpha.2 and it gives me this:

       /usr/local/lib/node_modules/bower/node_modules/configstore/index.js:56
            throw err;
            ^
    

Error: EACCES: permission denied, open '/Users/philip/.config/configstore/bower-github.yml' You don't have access to this file.

at Error (native)
at Object.fs.openSync (evalmachine.<anonymous>:549:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:397:15)
at Object.create.all.get (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:34:29)
at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:27: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:435:26)
at Object.Module._extensions..js (module.js:442:10)

Can somebody tell me why? Thanks!

EDIT:

I'm that far now:

     Philips-MacBook-Pro:test philip$ bower install bootstrap
     bower bootstrap#*           not-cached git://github.com/twbs/bootstrap.git#*
    bower bootstrap#*              resolve git://github.com/twbs/bootstrap.git#*
    bower bootstrap#*              ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/twbs/bootstrap.git", exit code of #69   Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

       Additional error details:
       Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Philip
  • 1,068
  • 3
  • 12
  • 21

1 Answers1

1

The reason you are getting the EACCESS error is without sudo is because you do not have permission to access those files.

To check the current permissions of a file/directory run:

ls -l <file or directory name>

at the terminal prompt.

You will see output similar to this:

drwxr--r-- 1 owner group...

for each listing.

The first character of that ouput represents the file type. In the example 'd' means the file listed is a directory. The second group of three characters describes the read ('r' in the example), write ('w') and execute ('x') permissions for the owner of the file.

The next three characters describe permissions for the group the file belongs to. In the example, you see 'r--'. This means the group that the file belongs to only has permission to read the file- no permission to write to (as indicated by the '-') or execute the file.

The final three characters describe the permissions for 'all users'. In the example, 'r--' indicates that all users have read-only access to the file.

This resource will help you understand *nix/OS X file permissions: http://www.comentum.com/unix-osx-permissions.html

In order to run those commands without sudo you will change the current permission settings to allow yourself read/write access to the files that are throwing EACCESS errors. This can be done through the GUI or with the chmod command at the terminal.

Running man chmod at the terminal brings up the man page (https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/chmod.1.html) for the chmod command.

user259743
  • 33
  • 8
  • okay, thank you! but I am the root user of my system. or am I not? what would you suggest to install bootstrap? shall I change the rights? – Philip Jan 20 '16 at 00:04
  • because I can't use `sudo` with bower. thats what it says – Philip Jan 20 '16 at 00:12
  • The command `whoami` will show you what user you are currently logged in as. I would investigate the permissions of the .yml file that is throwing the error. From there you could either: edit the permissions of that file so you can access it, edit the permissions of the containing folder recursively so that you have access to everything in them, OR change your user to the owner of the folder containing the file .yml file using the chown command. I'm not familiar with bower, but this seems like more of a general permissions problem. – user259743 Jan 20 '16 at 00:22
  • okay i've set the permissions. I edited my post. i got a new problem apparently – Philip Jan 20 '16 at 00:36