无法安装 Angular CLI [英] Can't install Angular CLI
问题描述
无论我尝试了多少次...我都无法在我的计算机上安装 Angular CLI...
No matter how many times i tried... i can't install Angular CLI on my computer...
我正在使用:
npm install -g @angular/cli
这是控制台错误日志:
C:\Users\Félix Bejarano\AppData\Roaming\npm\ng -> C:\Users\Félix Bejarano\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
npm ERR! path C:\Users\Félix Bejarano\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\fsevents\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall lstat
npm ERR! Error: EPERM: operation not permitted, lstat 'C:\Users\Félix Bejarano\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\fsevents\node_modules'
npm ERR! { Error: EPERM: operation not permitted, lstat 'C:\Users\Félix Bejarano\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\fsevents\node_modules'
npm ERR! stack: 'Error: EPERM: operation not permitted, lstat \'C:\\Users\\Félix Bejarano\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\fsevents\\node_modules\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'lstat',
npm ERR! path: 'C:\\Users\\Félix Bejarano\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\fsevents\\node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Félix Bejarano\AppData\Roaming\npm-cache\_logs\2018-03-27T22_56_59_735Z-debug.log
有什么帮助吗?
推荐答案
在 Windows 命令行中试试这个:
Try this in a windows command line:
首先使用相同的用户创建一个名为 npm-global
或直接在 C:\
下的目录,或者在您的用户名下创建它.C:\users\myuserId
.旁注:- 您用户名中的 é
字符 C:\Users\Félix Bejarano
可能有问题 - 我不知道.
First create a directory called npm-global
or something directly under C:\
with the same user OR create this under your user name. C:\users\myuserId
. Side note:- the é
character in your username C:\Users\Félix Bejarano
could a problem - I don't know.
在命令窗口中运行以下命令 -(对于 bash 等,您调整路径)
Run following command in a Command window - (for bash etc you adjust the paths)
npm config --global 设置前缀 c:\npm-global\npm
然后
npm config --global 设置缓存 C:\npm-global\npm-cache
这将为您提供一个您有权访问的干净文件夹.
This will get you a clean folder that you have access to.
这篇关于无法安装 Angular CLI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!