[webpack-cli] Error: Cannot find module ‘vue/compiler-sfc‘

简介: [webpack-cli] Error: Cannot find module ‘vue/compiler-sfc‘

Webpack打包vue文件的时候报错


[webpack-cli] Error: Cannot find module 'vue/compiler-sfc'

原因是我使用的是Vue2,而版本不对,以下是对应版本

Vue 3 requires vue-loader v16 + @vue/compiler-sfc;

Vue 2 requires vue-loader v15 + vue-template-compiler.


解决方式:降级使用15版本


$ cnpm i vue-loader@15 -D
相关文章
|
16天前
webpack版本问题 Cannot read property ‘createHash‘ of undefined
webpack版本问题 Cannot read property ‘createHash‘ of undefined
|
6月前
【Webpack】TypeError: Cannot read property ‘tap‘ of undefined at HtmlWebpackPlugin.
【Webpack】TypeError: Cannot read property ‘tap‘ of undefined at HtmlWebpackPlugin.
|
6月前
Webpack打包出错:Error: Cannot find module ‘webpack/lib/node/NodeTemplatePlugin‘ Require stack:
Webpack打包出错:Error: Cannot find module ‘webpack/lib/node/NodeTemplatePlugin‘ Require stack:
|
8月前
|
前端开发 JavaScript 编译器
【前端异常】vscode:无法将“cnpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称,Cannot find module ”webpack“
【前端异常】vscode:无法将“cnpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称,Cannot find module ”webpack“
397 0
|
8月前
|
JavaScript Cloud Native Go
Error: Cannot find module ‘webpack/bin/config-yargs‘ at Function.Module._resolveFilename (intern
Error: Cannot find module ‘webpack/bin/config-yargs‘ at Function.Module._resolveFilename (intern
39 0
|
9月前
Error: Cannot find module ‘webpack‘ 问题解决办法
Error: Cannot find module ‘webpack‘ 问题解决办法
99 1
|
10月前
|
JavaScript
UniApp 解决 Error: Cannot find module ‘webpack/lib/RuleSet‘
UniApp 解决 Error: Cannot find module ‘webpack/lib/RuleSet‘
374 0
|
12月前
|
资源调度 开发工具 git
Cannot find module 'webpack'
Cannot find module 'webpack'
使用antd-theme-webpack-plugin报错Error LessError: Cannot find module ‘antd/lib/style/themes/default.less
使用antd-theme-webpack-plugin报错Error LessError: Cannot find module ‘antd/lib/style/themes/default.less
938 0
使用antd-theme-webpack-plugin报错Error LessError: Cannot find module ‘antd/lib/style/themes/default.less
Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
Error: Cannot find module ‘webpack-cli/bin/config-yargs‘