繁体   English   中英

使用Yeoman安装角度的EACCES错误

[英]EACCES error using Yeoman to install angular

我试过跑步

yo angular --coffee --minsafe

但是我得到了这个错误

   Error: EACCES, permission denied '/Users/Basil/.config/configstore/insight-yo.yml'
        at Object.fs.openSync (fs.js:427:18)
        at Object.fs.writeFileSync (fs.js:966:15)
        at Object.create.all.set (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:39:7)
        at Object.Configstore (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:30:11)
        at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/insight.js:20:16)
        at Object.<anonymous> (/usr/local/lib/node_modules/yo/bin/yo:26: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)

我已经检查了Github上的问题,并看到npm / yeoman安装generator-angular没有sudo但似乎无法让它工作

node v0.10.17 npm v1.2.10

find / -name 'yeoman'

/Users/Basil/.node/node_modules/.bin/yeoman /Users/Basil/.node/node_modules/yeoman /Users/Basil/.node/node_modules/yeoman/bin/yeoman/Users/Basil/.node/node_modules/ yeoman / node_modules / yeoman-generators / lib / generators / yeoman /Users/Basil/.npm/yeoman/Users/Basil/.npm/yeoman/0.9.6/package/bin/yeoman/Users/Basil/.npm/yeoman -generators / 0.9.5 /包/ LIB /发电机/自耕农

我能用这个解决这个问题:

Sudo chown Basil /Users/Basil/.config/configstore/update-notifier-yo.yml

如果您遇到此问题,请尝试此操作,将“Basil”替换为您的用户名

你可以使用npm cache cleanbower cache clean

Sudo chown Basil /Users/Basil/.config/configstore/update-notifier-yo.yml (删除尾随chown)用您的用户名替换Basil。

Sudo chown <yourusername> /Users/<yourusername>/.config/configstore/update-notifier-yo.yml记住您的用户名不包括美元符号。

这在运行Yeoman时纠正了错误:

EACCES, permission denied '/Users/<yourusername>/.config/configstore/update-notifier-yo.yml'

如果以上操作无效,只需删除/Users/USER_NAME/.config/configstore/目录中的所有文件,然后再次运行yo angular。 将USER_NAME替换为您的用户名。

我刚刚在Windows中修复它。 我已经完成了三件事,其中一件已经修好了我不确定。

  1. 以管理员身份运行cmd提示符。

  2. takeown /? 这个命令相当于chown(linux)但是对于windows。

  3. cacls -cacls / E / T / G:F

  4. 只需进入$ USER /Users/calvin/.config/configstore/并将文件取消隐藏。

它像魅力一样对我有用。 很多天以来,我一直试图解决这个问题。

这可能为时已晚,但为了帮助其他人,更改权限(chmod)和所有者(chown)对我来说在Ubuntu上有用:

sudo chmod g+rwx /home/myusername/.config/configstore
sudo chown myusername /home/myusername/.config/configstore

这个对我有用:

//Update npm to the latest version. Works for to upgrade 1.x to 2.x.
$ npm install -g npm stable    
// Assign group permissions to the parent directory.
$ chmod g+rwx /root /root/.config /root/.config/configstore

您只需从用户主目录rm -rf /home/user/.config删除.config文件夹,然后运行sudo yo ,这将再次创建.config并重置以前的错误配置。 应用这种方法后,我的工作正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM