Vue报错总结
本文最后更新于:2 年前
解决:’webpack-dev-server’ 不是内部或外部命令,也不是可运行的程序 或批处理文件。
- 尝试多次删除
node_modules
文件夹然后npm install
- 如果上面的方法不可用就尝试
npm install webpack webpack-dev-server webpack-cli --save-dev
解决:Vue项目部署404问题
Gitee Page上部署需要添加一个vue.config.js文件
// vue.config.js module.exports = { publicPath: process.env.NODE_ENV === 'production' ? '/vue-audio/' : '/' }
需要将
.gitignore
中的/dist/
用#注释掉在
config/index.js
文件中找到build中的assetsPublicPath
build: { // Template for index.html index: path.resolve(__dirname, '../dist/index.html'), // Paths assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', //改成下方的这个路径 assetsPublicPath: './',
在
router/index.js
中关掉history
模式export default new Router({ //mode: 'history', routes: [ { path: '/', name: 'Audio', component: Audio } ] })
解决:Vue项目中使用element-ui静态页面部署时图标缺失的问题
在
build.utils.js
文件中添加一行if (options.extract) { return ExtractTextPlugin.extract({ use: loaders, fallback: 'vue-style-loader', publicPath: '../../' }) } else { return ['vue-style-loader'].concat(loaders) }
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!其他问题请通过下方微信联系!