Mac bower install bootstrap bug解决

最近都是用vue及基于vue的UI框架,比如Element,有些年没有用BootStrap了,不知怎么的今晚突然想装个BootStrap到自己的小项目看看,使用bower安装时一直报以下错误:
/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:54
throw err;
^
Error: EACCES: permission denied, open ‘/Users/XiaoQiang/.config/configstore/bower-github.json’
You don’t have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
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. (/usr/local/lib/node_modules/bower/lib/index.js:16:32)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)

百度查了很多方法,发现并没什么用,最多的说法是这个:

sudo bower install –allow-root
sudo bower install

亲测不可用,感觉答案都是复制粘贴发表的,参考价值不高。

最后在github找到解决办法,亲测可用。

sudo chown -R U S E R : GROUP ~/.npm
sudo chown -R U S E R : GROUP ~/.config

猜你喜欢

转载自blog.csdn.net/fabulous1111/article/details/79830776