You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行npm run serve时vuex文件缺失报错,重装无效求解决

问题

执行npm run serve启动项目时,持续出现以下错误:

ERROR in ./node_modules/vuex/dist/vuex.esm-bundler.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: ENOENT: no such file or directory, open 'C:\Users\Samuel\Documents\Universidad\WebDevelopment\cocinillas\elcocinillas\frontend\elcocinillas\node_modules\vuex\dist\vuex.esm-bundler.js'

已尝试卸载并重新安装不同版本的vuex,但问题未解决。

解决建议

  • 彻底清理依赖及缓存后重装:
    1. 删除项目根目录下的node_modules文件夹
    2. 删除package-lock.json或yarn.lock文件(根据使用的包管理器选择)
    3. 执行缓存清理命令:
      • npm:npm cache clean --force
      • yarn:yarn cache clean
    4. 重新安装依赖:npm install或yarn install
  • 检查项目中vuex的引入路径,确认是否存在拼写错误或引用了不存在的文件。比如部分版本差异下,应引入vuex.esm.js而非vuex.esm-bundler.js,可尝试修改引入语句后重启项目。
  • 检查babel-loader配置,确认是否对node_modules下文件的处理规则存在异常,比如误排除vuex相关文件、配置了错误的解析路径。
  • 确认Vue版本与vuex版本的兼容性:Vue 3需搭配vuex 4.x版本,Vue 2则需vuex 3.x版本,版本不匹配可能导致文件结构异常。

内容的提问来源于stack exchange,提问作者Sam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 11:05:55