简体   繁体   English

使用Yeoman安装角度的EACCES错误

[英]EACCES error using Yeoman to install angular

I tried running 我试过跑步

yo angular --coffee --minsafe

but I get this error 但是我得到了这个错误

   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)

I have checked the issues on Github and seen npm / yeoman install generator-angular without sudo but can't seem to get it to work 我已经检查了Github上的问题,并看到npm / yeoman安装generator-angular没有sudo但似乎无法让它工作

node v0.10.17 npm v1.2.10 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/package/lib/generators/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 /发电机/自耕农

I was able to fix this issue with this: 我能用这个解决这个问题:

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

If you run into this issue, try this out, replacing "Basil" with your username 如果您遇到此问题,请尝试此操作,将“Basil”替换为您的用户名

你可以使用npm cache cleanbower cache clean

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

Sudo chown <yourusername> /Users/<yourusername>/.config/configstore/update-notifier-yo.yml Keepinging in mind your username does not include the dollar sign. Sudo chown <yourusername> /Users/<yourusername>/.config/configstore/update-notifier-yo.yml记住您的用户名不包括美元符号。

This corrected the Error when running Yeoman: 这在运行Yeoman时纠正了错误:

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

If the above doesn't work simply delete all files in the /Users/USER_NAME/.config/configstore/ directory and run yo angular again. 如果以上操作无效,只需删除/Users/USER_NAME/.config/configstore/目录中的所有文件,然后再次运行yo angular。 Replace USER_NAME with your user name. 将USER_NAME替换为您的用户名。

I just fixed it in Windows. 我刚刚在Windows中修复它。 I have done three things, which one have fixed it I am not sure. 我已经完成了三件事,其中一件已经修好了我不确定。

  1. Run cmd prompt as administrator. 以管理员身份运行cmd提示符。

  2. takeown /? takeown /? this command is equivalent to chown (linux) but for windows. 这个命令相当于chown(linux)但是对于windows。

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

  4. simply go in $USER /Users/calvin/.config/configstore/ and make files unhidden. 只需进入$ USER /Users/calvin/.config/configstore/并将文件取消隐藏。

it worked for me like charm. 它像魅力一样对我有用。 I have been trying to fix this since many days. 很多天以来,我一直试图解决这个问题。

This is probably too late to answer but in order to help others, changing both permissions (chmod) and owner (chown) is what worked for me on Ubuntu: 这可能为时已晚,但为了帮助其他人,更改权限(chmod)和所有者(chown)对我来说在Ubuntu上有用:

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

This one worked for me : 这个对我有用:

//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

you can simply remove the .config folder from user home directory rm -rf /home/user/.config then run sudo yo which will create .config again and reset previous faulty configuration. 您只需从用户主目录rm -rf /home/user/.config删除.config文件夹,然后运行sudo yo ,这将再次创建.config并重置以前的错误配置。 Mine is working fine after apply this approach. 应用这种方法后,我的工作正常。

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

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