您好,登录后才能下订单哦!
本篇内容主要讲解“vue运行报错Error:Cannot find module '@vue/cli-plugin-babel'怎么解决”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“vue运行报错Error:Cannot find module '@vue/cli-plugin-babel'怎么解决”吧!
今天将VUE项目迁移到新的电脑上,配置不一样,导致报错:
Error: Cannot find module '@vue/cli-plugin-babel'
Require stack:
- D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+ cli-service@5.0.8- D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+cli-service@5.0.8\node_modules\@vue\cli-service\lib\Service.js
- D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+ cli-service@5.0.8- D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+cli-service@5.0.8\node_modules\@vue\cli-service\bin\vue-cli-service.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Module._load (node:internal/modules/cjs/loader:920:27)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at idToPlugin (D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+ cli-service@5.0.8 at idToPlugin (D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+cli-service@5.0.8\node_modules\@vue\cli-service\lib\Service.js:172:14)
at D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+ cli-service@5.0.8 at D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+cli-service@5.0.8\node_modules\@vue\cli-service\lib\Service.js:211:20
at Service.resolvePlugins (D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+ cli-service@5.0.8 at Service.resolvePlugins (D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+cli-service@5.0.8\node_modules\@vue\cli-service\lib\Service.js:198:10)
at Object.<anonymous> (D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+ cli-service@5.0.8 at Object.<anonymous> (D:\WWW\VUE\xxxxxx\node_modules\.store\@vue+cli-service@5.0.8\node_modules\@vue\cli-service\bin\vue-cli-service.js:15:17) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\WWW\\VUE\\xxxxxx\\node_modules\\.store\\@vue+ cli-service@5.0.8 'D:\\WWW\\VUE\\xxxxxx\\node_modules\\.store\\@vue+cli-service@5.0.8\\node_modules\\@vue\\cli-service\\lib\\Service.js',
'D:\\WWW\\VUE\\xxxxxx\\node_modules\\.store\\@vue+ cli-service@5.0.8\\node_modules\\@vue\\cli-service\\bin\\vue-cli-service.js'
]
}
删除node_modules文件夹后执行命令
npm update
仍然报错缺少“@vue/cli-plugin-babel”
在网上找了半天的方法,才找到只言片语。
原因:当前电脑nodejs版本过高,项目的配置太低,不匹配,如下package.json
{ "dependencies": { "node-sass": "^4.13.1", "sass-loader": "^7.3.1", }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.15", }, }
解决方法,删除这几行配置,重新安装。
npm install node-sass npm install sass-loader npm install @vue/cli-plugin-babel
重新运行问题解决
npm run serve
到此,相信大家对“vue运行报错Error:Cannot find module '@vue/cli-plugin-babel'怎么解决”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。