VUE项目问题

1.运行时,遇到依赖问题,Failed to resolve import "vue-demi" from "node_modules\.vite\deps\chunk-2MVFT65E.js, 重新安装依赖。

例:如下:

Failed to resolve import "vue-demi" from "node_modules\.vite\deps\chunk-2MVFT65E.js?v=b899afb1". Does the file exist?
10:08:24 [vite] Internal server error: Failed to resolve import "vue-demi" from "node_modules\.vite\deps\chunk-2MVFT65E.js?v=b899afb1". Does the file exist?
  File: D:/WorkSpaces/myProjects/vue3/vue-vben-admin-main-simply/node_modules/.vite/deps/chunk-2MVFT65E.js?v=b899afb1
  6  |  // node_modules/@vueuse/shared/index.mjs
  7  |  init_define_APP_INFO();
  8  |  import { computed, unref, watch, ref, customRef, isVue3, isRef, effectScope, getCurrentScope, onScopeDispose, shallowRef, watchSyncEffect, readonly, reactive, toRef, isVue2, set as set$1, toRefs 
as toRefs$1, getCurrentInstance, onBeforeUnmount, onMounted, nextTick, onUnmounted } from "vue-demi";
     |
                                                                                           ^
  9  |  function and(...args) {
  10 |    return computed(() => args.every((i) => unref(i)));

解决:
重新安装vue-demi

npm i vue-demi

2. 问题”getaddrinfo ENOENT raw.githubusercontent.com“

npm WARN deprecated @volar/html2pug@0.28.10: WARNING: This project has been renamed to @johnsoncodehk/html2pug. Install using @johnsoncodehk/html2pug instead.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated vscode-pug-languageservice@0.28.10: WARNING: This project has been renamed to @volar/pug-language-service. Install using @volar/pug-language-service instead.
npm WARN deprecated vscode-typescript-languageservice@0.28.10: WARNING: This project has been renamed to @volar/typescript-language-service. Install using @volar/typescript-language-service instead.
npm WARN deprecated vscode-vue-languageservice@0.28.10: WARNING: This project has been renamed to @volar/vue-language-service. Install using @volar/vue-language-service instead.
npm ERR! code 1
npm ERR! path D:\WorkSpaces\myProjects\vue3\vben-admin-thin-next\node_modules\gifsicle
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node lib/install.js
npm ERR! compiling from source
npm ERR! getaddrinfo ENOENT raw.githubusercontent.com
npm ERR! gifsicle pre-build test failed
npm ERR! Error: Command failed: C:\Windows\system32\cmd.exe /s /c "autoreconf -ivf"
npm ERR! 'autoreconf' �����ڲ����ⲿ���Ҳ���ǿ����еij���
npm ERR! ���������ļ���
npm ERR!
npm ERR!
npm ERR!     at D:\WorkSpaces\myProjects\vue3\vben-admin-thin-next\node_modules\bin-build\node_modules\execa\index.js:231:11
npm ERR!     at runMicrotasks (<anonymous>)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR!     at async Promise.all (index 0)

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\WorkSpaces\vue3\node_cache\_logs\2022-10-08T02_36_16_284Z-debug-0.log

解决:

查看raw.githubusercontent.com的真实IP地址
点开网址 https://www.ipaddress.com/ ,输入raw.githubusercontent.com,点击查询:

复制以下的ip
 

修改hosts文件

找到这个文件夹: C:\Windows\System32\drivers\etc 下的hosts

以管理员身份运行笔记本打开hosts,在最后一行增加如下四行

185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com

 保存成功后去项目就可重新安装插件

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值