【VUE】npm打包报错 Syntax Error: Error: Cannot find module ‘imagemin-gifsicle‘

一. Syntax Error: Error: Cannot find module 'imagemin-gifsicle'

  1. npm run build 报错,报错如下
  2. 原因
    这个错误消息显示缺少了 imagemin-gifsicle 模块,而它是 image-webpack-loader 的依赖项,导致构建失败。
  3. 解决
    (1)方法一

    (2)方法二
    卸载已有的image-webpack-loader,用 cnpm 重新安装
bash 复制代码
// 卸载
 npm uninstall image-webpack-loader
// cnpm 安装
cnpm install --save-dev image-webpack-loader

二. Vue packages version mismatch:vue-template-compiler

  1. 报错信息如下
bash 复制代码
Error: 

Vue packages version mismatch:

- vue@2.6.14 (D:\workDir\xxx\xxx\web\node_modules\vue\dist\vue.runtime.common.js)
- vue-template-compiler@2.7.14 (D:\workDir\xxx\xxx\web\node_modules\vue-template-compiler\package.json)

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.
  1. 原因
    这个错误信息显示您当前安装的 Vue.js 版本与 vue-template-compiler 版本不匹配,可能会导致一些问题。为了确保正常工作,应该确保这两者使用相同的版本。
  2. 解决
    更新 vue-template-compiler 版本
    npm install vue-template-compiler@2.6.14

三. This dependency was not found:composition-api

  1. 报错信息如下
bash 复制代码
This dependency was not found:

* @vue/composition-api/dist/vue-composition-api.mjs in ./node_modules/vue-demi/lib/index.mjs

To install it, you can run: npm install --save @vue/composition-api/dist/vue-composition-api.mjs
Error from chokidar (D:\): Error: EBUSY: resource busy or locked, lstat 'D:\DumpStack.log.tmp'
  1. 原因
    `这个错误提示表明项目中的某个模块依赖了 @vue/composition-api 的特定文件 vue-composition-api.mjs,但是该文件未被找到,导致构建失败。
  2. 解决
    安装 @vue/composition-api
bash 复制代码
npm install --save @vue/composition-api

四. These dependencies were not found:vab-icons vab-icons/lib/vab-icons.css

  1. 报错如下
相关推荐
Hi_kenyon4 小时前
VUE3套用组件库快速开发(以Element Plus为例)二
开发语言·前端·javascript·vue.js
Irene19914 小时前
Vue 3 响应式系统类型关系总结(附:computed、props)
vue.js·props·响应式类型
起名时在学Aiifox4 小时前
Vue 3 响应式缓存策略:从页面状态追踪到智能数据管理
前端·vue.js·缓存
天若有情6735 小时前
校园二手交易系统实战开发全记录(vue+SpringBoot+MySQL)
vue.js·spring boot·mysql
计算机程序设计小李同学5 小时前
个人数据管理系统
java·vue.js·spring boot·后端·web安全
李剑一5 小时前
uni-app实现本地MQTT连接
前端·trae
EndingCoder5 小时前
Any、Unknown 和 Void:特殊类型的用法
前端·javascript·typescript
oden5 小时前
代码高亮、数学公式、流程图... Astro 博客进阶全指南
前端
GIS之路5 小时前
GDAL 实现空间分析
前端