Tag Archives: vue-cli3

Solution of invalid host header in vue-cli3

Discovery scene

Recently, a project has been built with vue-cli3. As a result, it keeps reporting errors. The error information is as follows:

Invalid Host/Origin header

At the same time, we also found another problem, that is, the hot update also failed

Causes

The new version of webpack dev server adds security verification. By default, the host name is checked. If the host name is not in the configuration, the access will be interrupted.

Solution

Create a file in the root directory vue.config.js , and then fill in the following

module.exports = {
    devServer: {
        disableHostCheck: true,
    }
}

Restart the service and find hot updates.

Solution to the problem of selecting node sass when creating vue-cli3

Because :
vue-cli3.0 defaults to using the yarn package management tool instead of the original NPM

In yarn, node-sass, the default download will most likely fail if you don’t over the wall

The solution

	yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

So when use the yarn to download the node – sass don’t stuck an error failed to install
this method not only solve the vue cli3 installation node – sass error
is used to solve the yarn package management tools installation node – sass error problem
Problem solving