每次我使用命令ember new myapp
时,它都会抛出这些错误:
/usr/local/lib/node_modules/ember-cli/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/MyAccount/.config/configstore/ember-cli.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:431:33)
at Object.create.all.get (/usr/local/lib/node_modules/ember-cli/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/ember-cli/node_modules/configstore/index.js:27:44)
at clientId (/usr/local/lib/node_modules/ember-cli/lib/cli/index.js:22:21)
at module.exports (/usr/local/lib/node_modules/ember-cli/lib/cli/index.js:64:19)
at /usr/local/lib/node_modules/ember-cli/bin/ember:26:3
at /usr/local/lib/node_modules/ember-cli/node_modules/resolve/lib/async.js:46:14
at process (/usr/local/lib/node_modules/ember-cli/node_modules/resolve/lib/async.js:173:43)
我尝试清除npm
缓存,但问题仍然存在。如何纠正这个?
答案 0 :(得分:2)
更改权限
chmod -R 777 /Users/MyAccount/.config/configstore
或(如有必要)
sudo chmod -R 777 /Users/MyAccount/.config/configstore
如果您担心安全问题,可以稍后更改权限,例如。阻止客人
chmod -R 771 /Users/MyAccount/.config/configstore
每个号码分别设置用户,组和其他的权限。数字表示(sourced from here):
0 == --- == no access
1 == --x == execute
2 == -w- == write
3 == -wx == write / execute
4 == r-- == read
5 == r-x == read / execute
6 == rw- == read / write
7 == rwx == read / write / execute
答案 1 :(得分:0)
当我尝试使用像ng serve / ng version这样的命令时,我得到了同样的错误。我试过这个命令并且有效
chmod -R 777 /Users/MyAccount/.config/configstore
将myAccount替换为您的帐户名称。它应该可以解决您的问题
答案 2 :(得分:0)
您还可以使用sudo权限运行ng serve / ng版本。
sudo ng serve
答案 3 :(得分:0)
错误:EACCES:权限被拒绝,打开 ' /home/ethem/.config/configstore/ember-cli.json'
您必须像user:group一样授予权限。您的用户也足够您的小组。 sudo chown -R OS_USER:OS_USER .config
例如,对于上述错误,此命令已修复
sudo chown -R ethem:ethem .config
答案 4 :(得分:0)
:)获取相同的错误并使用以下命令修复它
sudo chmod 777 /Users/{{-username-}}/.babel.json
或者在下方打开新的终端
ls -al
检查该文件
如果你得到了打击
sudo chmod 777 .babel.json