今天在安裝vue-cli時(shí),報(bào)了如下的錯(cuò)誤,各種問題,各種博客,都說權(quán)限
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN tarball tarball data for typescript@~3.7.5 (sha1-BpLiH2X9QQi5MwI4qsEd0uF3oa4=) seems to be corrupted. Trying one more time.
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\Cheng Feng\AppData\Roaming\npm\node_modules\.staging\typescript-e7a1b473\lib\typescriptServices.js
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Cheng Feng\AppData\Roaming\npm\node_modules\.staging\typescript-e7a1b473\lib\typescriptServices.js'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\Cheng Feng\AppData\Roaming\npm\node_modules\.staging\typescript-e7a1b473\lib\typescriptServices.js'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\Cheng Feng\AppData\Roaming\npm\node_modules\.staging\typescript-e7a1b473\lib\typescriptServices.js'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Cheng Feng\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-e7a1b473\\lib\\typescriptServices.js'
npm ERR! },
npm ERR! stack: "Error: EPERM: operation not permitted, unlink 'C:\\Users\\Cheng Feng\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-e7a1b473\\lib\\typescriptServices.js'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Cheng Feng\\AppData\\Roaming\\npm\\node_modules\\.staging\\typescript-e7a1b473\\lib\\typescriptServices.js',
npm ERR! parent: '@vue/cli'
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\Cheng Feng\AppData\Roaming\npm-cache\_logs\2020-03-30T08_05_53_100Z-debug.log
網(wǎng)上百度最多的就是權(quán)限問題,報(bào)的錯(cuò)誤也提示權(quán)限問題.

圖片.png
這里也在提示權(quán)限問題,看他的,就錯(cuò)了!!!
本質(zhì)是緩存的問題.需要?jiǎng)h除npmrc文件.
注意:
不是nodejs安裝目錄npm模塊下的那個(gè)npmrc文件
而是在C:\Users{用戶}\下的.npmrc文件..

圖片.png
將這個(gè)文件刪除后,清除一下緩存

圖片.png
然后再執(zhí)行 npm i -g @vue/cli

圖片.png
打完收工!!!搞定!!!