<h1 dir="auto">Bug report</h1>
<p dir="auto">meta duplicate</p>
<h2 dir="auto">Describe the bug</h2>
<p dir="auto">meta duplicate<br>
A clear and concise description of what the bug is.<br>
if add  in _document.js<br>
just like</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// _document is only rendered on the server side and not on the client side
// Event handlers like onClick can&quot;t be added to this file

// ./pages/_document.js
import Document, {Html, Head, Main, NextScript} from &quot;next/document&quot;;
import React from &quot;react&quot;;

class MyDocument extends Document {
    static async getInitialProps(ctx) {
        const initialProps = await Document.getInitialProps(ctx);
        return {...initialProps};
    }

    render() {
        return (
            &lt;Html&gt;
            &lt;Head&gt;
                &lt;link rel=&quot;icon&quot; href=&quot;../static/favicon.ico&quot; type=&quot;image/x-icon&quot;/&gt;
                &lt;link rel=&quot;shortcut icon&quot; href=&quot;../static/favicon.ico&quot; type=&quot;image/x-icon&quot;/&gt;

                &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;/&gt; // bug 在每个页面的 Head 里面加这一行，否则系统会默认加这一行
            &lt;/Head&gt;
            &lt;body&gt;
            &lt;Main/&gt;
            &lt;NextScript/&gt;
            &lt;/body&gt;
            &lt;/Html&gt;
        );
    }
}

export default MyDocument;
"><pre class="notranslate"><code class="notranslate">// _document is only rendered on the server side and not on the client side
// Event handlers like onClick can"t be added to this file

// ./pages/_document.js
import Document, {Html, Head, Main, NextScript} from "next/document";
import React from "react";

class MyDocument extends Document {
    static async getInitialProps(ctx) {
        const initialProps = await Document.getInitialProps(ctx);
        return {...initialProps};
    }

    render() {
        return (
            &lt;Html&gt;
            &lt;Head&gt;
                &lt;link rel="icon" href="../static/favicon.ico" type="image/x-icon"/&gt;
                &lt;link rel="shortcut icon" href="../static/favicon.ico" type="image/x-icon"/&gt;

                &lt;meta name="viewport" content="width=device-width"/&gt; // bug 在每个页面的 Head 里面加这一行，否则系统会默认加这一行
            &lt;/Head&gt;
            &lt;body&gt;
            &lt;Main/&gt;
            &lt;NextScript/&gt;
            &lt;/body&gt;
            &lt;/Html&gt;
        );
    }
}

export default MyDocument;

</code></pre></div>
<p dir="auto">and also add Head tag in page.js, just like</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import React from &quot;react&quot;;
import Head from &quot;next/head&quot;;
import {withRouter} from &quot;next/router&quot;;

export default withRouter(class extends React.Component {

    constructor(props) {
        super(props);
    }

    render() {
        console.log(this.props.router.asPath);
        return (
            &lt;div&gt;
                &lt;Head&gt;
                    &lt;title&gt;xxxxxx&lt;/title&gt;
                &lt;/Head&gt;
            &lt;/div&gt;
        );
    }
});
"><pre class="notranslate"><code class="notranslate">import React from "react";
import Head from "next/head";
import {withRouter} from "next/router";

export default withRouter(class extends React.Component {

    constructor(props) {
        super(props);
    }

    render() {
        console.log(this.props.router.asPath);
        return (
            &lt;div&gt;
                &lt;Head&gt;
                    &lt;title&gt;xxxxxx&lt;/title&gt;
                &lt;/Head&gt;
            &lt;/div&gt;
        );
    }
});

</code></pre></div>
<p dir="auto">the result is</p>
<p dir="auto">nextjs will auto add  to page</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/7344437/56802944-f98f4080-6853-11e9-8b46-b3faaae88dd9.png"><img src="https://user-images.githubusercontent.com/7344437/56802944-f98f4080-6853-11e9-8b46-b3faaae88dd9.png" alt="image" style="max-width: 100%;"></a></p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior, please provide code snippets or a repository:</p>
<ol dir="auto">
<li>Go to '...'</li>
<li>Click on '....'</li>
<li>Scroll down to '....'</li>
<li>See error</li>
</ol>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">A clear and concise description of what you expected to happen.</p>
<h2 dir="auto">Screenshots</h2>
<p dir="auto">If applicable, add screenshots to help explain your problem.</p>
<h2 dir="auto">System information</h2>
<ul dir="auto">
<li>OS: [e.g. macOS, Windows]</li>
<li>Browser (if applies) [e.g. chrome, safari]</li>
<li>Version of Next.js: [e.g. 6.0.2]</li>
</ul>
<h2 dir="auto">Additional context</h2>
<p dir="auto">Add any other context about the problem here.</p>
<p dir="auto">[x] I have searched the issues of this repository and believe that this is not a duplicate.</p>
<p dir="auto">I try to use fs in _document.js, developement &amp; build process is success, but when I tried to run in production mode.  I got the message.</p>
<p dir="auto"><code class="notranslate">Error: EBADF: bad file descriptor, fstat</code></p>
<p dir="auto">My understand. _document.js can use on _document.js because it only runs on server-side only right?</p>
<p dir="auto">What else, I need to config</p>
<h2 dir="auto">My Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>5.1</td>
</tr>
<tr>
<td>node</td>
<td>8.9.3</td>
</tr>
<tr>
<td>OS</td>
<td>OSX</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome</td>
</tr>
</tbody>
</table>