bower安裝前端框架包permission denied解決辦法
阿新 • • 發佈:2019-01-31
前幾天裝了雙系統,嚐鮮裝了ubuntu17.10,發現好像有好多軟體不相容,網上解決方法也不多,於是放棄了17,迴歸到16.04系統,好了,這些都是題外話,由於專案程式碼用到bower,而我的bower在載入時候報錯
/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:54 throw err; ^ Error: EACCES: permission denied, open '/home/teddy/.config/configstore/bower-github.json' You don't have access to this file. at Object.fs.openSync (fs.js:667:18) at Object.fs.readFileSync (fs.js:572:33) at Configstore.get (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:35:26) at new Configstore (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:28:45) 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:649:30) at Object.Module._extensions..js (module.js:660:10)
從提示中可以看出是由於缺乏許可權,當我進入目錄
/home/teddy/.config 發現許可權都變成了root了,但是bower的許可權不能屬於root,於是我們就可以很簡單的通過錯誤提示修改許可權用chown操作命令修改許可權,再執行bower install 就可以正常下載bower的庫包了