无法安装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 set prefix c:\npm-global\npm
然后
npm config --global set cache C:\npm-global\npm-cache
这将为您提供一个可以访问的干净文件夹.
This will get you a clean folder that you have access to.
这篇关于无法安装Angular CLI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!