bower的权限问题

时间:2024-09-17 15:35:56

装bootstrap的时候,先用sudo指令装了bower,但是一打 bower isntall bootstrap 就报错:

Error: EACCES, permission denied '/Users/narumi/.config/configstore/bower-github.yml'

You don't have access to this file.

    at Object.fs.openSync (evalmachine.<anonymous>::)

    at Object.fs.readFileSync (evalmachine.<anonymous>::)

    at Object.create.all.get (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js::)

    at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js::)

    at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js::)

    at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js::)

    at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js::)

    at Module._compile (module.js::)

    at Object.Module._extensions..js (module.js::)

    at Module.load (module.js::)

还想用sudo?然并luan。

bower ESUDO         Cannot be run with sudo

借鉴了*上面达人的回答,先chown

sudo chown -R $USER ~/.config/configstore/

然后再 bower install bootstrap 会提示

May bower anonymously report usage statistics to improve the tool over time? 敲个Y or N,回车

然搞定:

bower not-cached    git://github.com/twbs/bootstrap.git#*

bower resolve       git://github.com/twbs/bootstrap.git#*

bower download      https://github.com/twbs/bootstrap/archive/v3.3.6.tar.gz

bower progress      bootstrap#* received .9MB of .8MB downloaded, %

bower progress      bootstrap#* received .9MB of .8MB downloaded, %

bower progress      bootstrap#* received .9MB of .8MB downloaded, %

bower progress      bootstrap#* received .0MB of .8MB downloaded, %

bower progress      bootstrap#* received .0MB of .8MB downloaded, %

bower progress      bootstrap#* received .0MB of .8MB downloaded, %

bower progress      bootstrap#* received .0MB of .8MB downloaded, %

bower progress      bootstrap#* received .1MB of .8MB downloaded, %

bower progress      bootstrap#* received .1MB of .8MB downloaded, %

bower progress      bootstrap#* received .2MB of .8MB downloaded, %

bower progress      bootstrap#* received .4MB of .8MB downloaded, %

bower progress      bootstrap#* received .6MB of .8MB downloaded, %

bower progress      bootstrap#* received .9MB of .8MB downloaded, %

bower progress      bootstrap#* received .3MB of .8MB downloaded, %

bower progress      bootstrap#* received .8MB of .8MB downloaded, %

bower progress      bootstrap#* received .2MB of .8MB downloaded, %

bower progress      bootstrap#* received .5MB of .8MB downloaded, %

bower progress      bootstrap#* received .6MB of .8MB downloaded, %

bower progress      bootstrap#* received .8MB of .8MB downloaded, %

bower extract       bootstrap#* archive.tar.gz

bower resolved      git://github.com/twbs/bootstrap.git#3.3.6

bower not-cached    git://github.com/jquery/jquery-dist.git#1.9.1 - 2

bower resolve       git://github.com/jquery/jquery-dist.git#1.9.1 - 2

bower download      https://github.com/jquery/jquery-dist/archive/2.2.0.tar.gz

bower extract       jquery#1.9. -  archive.tar.gz

bower resolved      git://github.com/jquery/jquery-dist.git#2.2.0

bower install       bootstrap#3.3.

bower install       jquery#2.2.

延伸阅读 每天一个linux命令(30): chown命令