我在使用Vuejs 2和webpack 5时遇到了这个问题:
ERROR ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options has an unknown property 'public'. These properties are valid:
object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }
ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options has an unknown property 'public'. These properties are valid:
object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }
at validate (C:\Users\erbisilva\Documents\GitHub\hefesto\hefesto-website\node_modules\webpack-dev-server\node_modules\schema-utils\dist\validate.js:158:11)
at new Server (C:\Users\erbisilva\Documents\GitHub\hefesto\hefesto-website\node_modules\webpack-dev-server\lib\Server.js:270:5)
at serve (C:\Users\erbisilva\Documents\GitHub\hefesto\hefesto-website\node_modules\@vue\cli-service\lib\commands\serve.js:194:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
字符串
我发现了很多其他的帖子,没有什么帮助我:
put allowedhosts to all
deleted node_modules and .lock.json
changed package.json file
型
还是一样的问题
在4.5版本中(我相信),它可以使用:
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: [
'vuetify'
],
lintOnSave: false,
devServer: {
public: process.env.VUE_APP_DOMAIN,
port: 8000
},
})
型
但是webpack5似乎是一个问题,我不能解决它
谁能给予我一点“光”?我正在尝试将我的项目部署到digitalocean。如果我在没有devServer的情况下部署,它会给我一个错误:
Invalid host header
型
我想这是因为我缺少devServer配置。但是当我加进去的时候,我就有那个问题了
先谢了
2条答案
按热度按时间nukf8bse1#
变更后:
字符串
当我尝试访问该页面时出现此错误。我正在使用数字海洋进行部署
型
tcomlyy62#
Webpack 4.5:
字符串
变更为:
型