加上chainWebpack部分后运行报错

来源:3-1 目录结构 & header 组件

缱绻091

2020-04-16

这部分代码在报错,但找不到原因

  devServer: {
    before (app) {
      app.get('/api/seller', function (req, res) {
        res.json({
          errno: 0,
          data: seller
        })
      })
      app.get('/api/goods', function (req, res) {
        res.json({
          errno: 0,
          data: goods
        })
      })
      app.get('/api/ratings', function (req, res) {
        res.json({
          errno: 0,
          data: ratings
        })
      })
    },
    chainWebpack (config) {
      config.resolve.alias
        .set('components', resolve('src/components'))
        .set('common', resolve('src/common'))
    },
    baseUrl: ''
  }

报错信息如下:
ERROR ValidationError: webpack Dev Server Invalid Options

options should NOT have additional properties
options should NOT have additional properties

ValidationError: webpack Dev Server Invalid Options

options should NOT have additional properties
options should NOT have additional properties
at validateOptions (D:\vue\vue_sell_cube_4.0\node_modules\webpack-dev-server\node_modules\schema-utils\src\validateOptions.js:32:11)
at new Server (D:\vue\vue_sell_cube_4.0\node_modules\webpack-dev-server\lib\Server.js:57:5)
at serve (D:\vue\vue_sell_cube_4.0\node_modules@vue\cli-service\lib\commands\serve.js:165:20)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue_sell_cube_4.0@0.1.0 serve: vue-cli-service serve
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue_sell_cube_4.0@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Lenovo\AppData\Roaming\npm-cache_logs\2020-04-15T20_39_30_177Z-debug.log

写回答

2回答

ustbhuangyi

2020-04-17

//img.mukewang.com/szimg/5e990672091c29f709760092.jpg
这里是数字 0 还不是字符串 0

0
1
缱绻091
非常感谢!
2020-04-23
共1条回复

ustbhuangyi

2020-04-16

你把代码传到 GitHub 上,我抽空帮你看看

0
1
缱绻091
谢谢老师!我这个问题解决了,但是运行起来后发现数据没有绑定上。以下是我的 github 地址 https://github.com/eddiechang091/vueproject
2020-04-17
共1条回复

Vue.js2.5+cube-ui重构饿了么App(经典再升级)

掌握Vue1.0到2.0再到2.5最全版本应用与迭代,打造极致流畅的WebApp

9868 学习 · 4162 问题

查看课程