首页 > 解决方案 > npm install -g @vue/cli VUE CLI安装错误

问题描述

我只是想安装 Vue CLI,但我收到了这个错误。我有最新版本的 node.js,如下所示。我尝试了一些不同的方法,例如npm uninstall -g vue-cliand npm cache clean --force。但他们没有工作。我该如何解决?

我的 npm 版本是 7.0.3。

C:\Users\HALİL_MONSTER>NODE
Welcome to Node.js v15.0.1.
Type ".help" for more information.

C:\Users\HALİL_MONSTER>npm install -g @vue/cli
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\HALİL_MONSTER\AppData\Roaming\npm\node_modules\@vue\cli
npm ERR! dest C:\Users\HALİL_MONSTER\AppData\Roaming\npm\node_modules\@vue\.cli-P415H8gb
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\HALİL_MONSTER\AppData\Roaming\npm\node_modules\@vue\cli' -> 'C:\Users\HALİL_MONSTER\AppData\Roaming\npm\node_modules\@vue\.cli-P415H8gb'
npm ERR!  [Error: EPERM: operation not permitted, rename 'C:\Users\HALİL_MONSTER\AppData\Roaming\npm\node_modules\@vue\cli' -> 'C:\Users\HALİL_MONSTER\AppData\Roaming\npm\node_modules\@vue\.cli-P415H8gb'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'C:\\Users\\HALİL_MONSTER\\AppData\\Roaming\\npm\\node_modules\\@vue\\cli',
npm ERR!   dest: 'C:\\Users\\HALİL_MONSTER\\AppData\\Roaming\\npm\\node_modules\\@vue\\.cli-P415H8gb'
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\HALİL_MONSTER\AppData\Local\npm-cache\_logs\2020-10-30T19_06_23_457Z-debug.log

标签: node.jsvue.jsnpm-installvue-cli

解决方案


我在终端中下载 Vue 时遇到了同样的问题。我通过使用解决了这个问题:

sudo npm install -g @vue/cli

然后我检查它是否正确安装并且是最新的:

vue --version

推荐阅读