PerillaQ 2022-04-01 09:35 采纳率: 0%
浏览 287

在Visual Studio Code安装脚手架时 实行 npm i -g @vue/cli命令报错

PS E:\脚手架vue-cli> npm i -g @vue/cli
npm WARN registry Unexpected warning for https://registry.npm.taobao.org/: Miscellaneous Warning EPERM: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_gobal\_cacache\tmp\01e2fb3a'
npm WARN registry Using stale data from https://registry.npm.taobao.org/ due to a request error during revalidation.
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Program Files\nodejs\node_gobal_cacache\tmp\2f79bd04
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmmirror.com/typescript: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_gobal_cacache\tmp\2f79bd04'
npm ERR! at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR! at async Promise.all (index 30)
npm ERR! at async Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\build-ideal-tree.js:855:5)
npm ERR! at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\build-ideal-tree.js:209:7)
npm ERR! at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\npm ERR! at async install (C:\Program Files\nodejs\node_modules\npm\lib\install.js:38:3)
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmmirror.com/typescript: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_gobal_cacache\tmp\2f79bd04'
npm ERR! at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR! at async Promise.all (index 30)
npm ERR! at async Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\build-ideal-tree.js:855:5)
npm ERR! at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\build-ideal-tree.js:209:7)
npm ERR! at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\reify.js:127:5)
npm ERR! at async install (C:\Program Files\nodejs\node_modules\npm\lib\install.js:38:3) {
npm ERR! code: 'EPERM',
npm ERR! errno: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\Program Files\nodejs\node_gobal\_cacache\tmp\2f79bd04',
npm ERR! type: 'system',
npm ERR! requiredBy: 'node_modules/@vue/cli/node_modules/@vue/cli-ui'
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.

img

这是我尝试过的方法

img


一:
C:\WINDOWS\system32>npm config set proxy null

C:\WINDOWS\system32>npm config set https-proxy null

C:\WINDOWS\system32>npm config set registry http://registry.cnpmjs.org/

C:\WINDOWS\system32>npm install -g cnpm --registry=https://registry.npm.taobao.org/

但是不行,
二:
在cmd :C:\WINDOWS\system32>npm install --registry=https://registry.npm.taobao.org/

up to date in 698ms
然后再回去终端npm i -g @vue/cli
就报以下错误:
npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.cnpmjs.org/@vue%2fcli failed, reason: getaddrinfo ENOTFOUND registry.cnpmjs.org
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

img

求解,如何才能安装好脚手架?谢谢

问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果
  • 写回答

3条回答 默认 最新

  • 关注

    nodejs是什么版本?默认是安装最新版本,可能版本兼容性问题。

    评论 编辑记录

报告相同问题?

问题事件

  • 创建了问题 4月1日

悬赏问题

  • ¥15 求高通平台Softsim调试经验
  • ¥15 canal如何实现将mysql多张表(月表)采集入库到目标表中(一张表)?
  • ¥15 wpf ScrollViewer实现冻结左侧宽度w范围内的视图
  • ¥15 栅极驱动低侧烧毁MOSFET
  • ¥30 写segy数据时出错3
  • ¥100 linux下qt运行QCefView demo报错
  • ¥50 F1C100S下的红外解码IR_RX驱动问题
  • ¥20 基于matlab的航迹融合 航迹关联 航迹插补
  • ¥15 用Matlab实现图中的光线追迹
  • ¥15 联想笔记本开机出现系统更新界面