项目场景:vue2项目启动
问题描述
在用 vue-cli
创建的基于 vue2 框架
的项目,在安装好 node-modules
之后,运行命令 ‘npm run serve’,会出现以下报错
ERROR in Conflict: Multiple assets emit different content to the same filename index.html
这句话的中文翻译是:冲突中的错误:多个资产向同一文件名index.html发出不同的内容
原因分析:
原因有两种:
① 创建项目时用了中文
② 配置问题 在创建项目时,文件名重名问题
解决方案:
方案1:更改一下自己的项目名称,最好全部用英文
方案2 : 把public 的index.html 更改为 index.ejs
在
node_nodules/webpack/bin/webpack.js
中加入html: { template: './src/index.ejs' }
代码: html: { template: './src/index.ejs' }