EACCES:尝试生成Angular组件时权限被拒绝

时间:2019-05-04 01:38:45

标签: angular angular-cli

当我尝试为Angular应用程序生成新组件时,我立即收到权限被拒绝的错误,但我不知道为什么。我尝试运行的命令是

ng g component heroes

我已经在项目文件夹及其所有包含的文件上尝试了chmod -R 755,但是不幸的是,这不会改变结果。

这是我每次运行命令时收到的错误消息。

EACCES: permission denied, mkdir '/Users/mynamehere/Documents/Web Dev/projects/angular/angular-tour-of-heroes/src/app/heroes'
[Finished in 3.5s with exit code 1]
[cmd: ['ng', 'g', 'component', 'heroes']]
[dir: /Users/evanjameson/Documents/Web Dev/projects/angular/angular-tour-of-heroes]
[path: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/smlnj/bin]

这来自sublime中的AngularCLI软件包。当我在终端中运行相同的命令时,会收到相同的错误消息。

1 个答案:

答案 0 :(得分:0)

尝试fac(而不是chmod 777),然后查看生成的文件的所有者。可能sublime正在与您不同的uid下运行