我一直在寻找解决方案,但我仍然无法在我的计算机上安装Angular CLI。我总是收到错误。什么地方出问题了?帮助。
我已经尝试以管理员身份运行cmd行,但仍然不起作用。我还尝试清除了npm缓存。
我的node.js是最新版本: Node.js v15.5.1。
这是控制台日志错误:
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Program Files (x86)\Nodist\bin\node_modules\@angular\cli
npm ERR! dest C:\Program Files (x86)\Nodist\bin\node_modules\@angular\.cli-gTnE0exE
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Program Files (x86)\Nodist\bin\node_modules\@angular\cli' -> 'C:\Program Files (x86)\Nodist\bin\node_modules\@angular\.cli-gTnE0exE'
npm ERR! [Error: EPERM: operation not permitted, rename 'C:\Program Files (x86)\Nodist\bin\node_modules\@angular\cli' -> 'C:\Program Files (x86)\Nodist\bin\node_modules\@angular\.cli-gTnE0exE'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\@angular\\cli',
npm ERR! dest: 'C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\@angular\\.cli-gTnE0exE'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.发布于 2021-01-15 21:02:37
我认为你应该这样做:如果你在windows上,试着使用admin access运行下面的命令,在基于linux的系统上,使用sudo:
npm uninstall -g @angular/cli
npm cache clean --force这些命令将实际删除以前的安装,然后检查:
ng --version --> it should throw an error 重新安装angular包:
npm install -g @angular/cli然后再次检查您的版本:
ng --version要添加更多内容,您可以使用多个版本的node。因此,如果您使用的是基于linux的计算机。您可以安装nvm,也可以安装多个版本的node:https://github.com/nvm-sh/nvm --对于windows,您可以使用以下命令:https://github.com/coreybutler/nvm-windows
通过这种方式,您可以检查是什么版本的node导致了问题,或者这实际上是angular安装的问题。
https://stackoverflow.com/questions/65736326
复制相似问题