<p dir="auto">I deployed my app on heroku and it returns a 404 error if I disable file system routing and use a custom route file. I also use express server.</p>
<p dir="auto">I use <code class="notranslate">next-routes</code> library and here is my source files.</p>
<h3 dir="auto">routes.js</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const routes = module.exports = require('next-routes')();

routes
.add({name: 'community', pattern: '/community', page: 'profiles'})
.add({name: 'locations', pattern: '/community/locations', page: 'locations'})
.add({name: 'categories', pattern: '/community/categories', page: 'categories'})
.add({name: 'talents', pattern: '/community/talents', page: 'talents'})
.add({name:'dashboard', pattern: '/dashboard', page: 'dashboard'})
.add({name:'pricing', pattern: '/pricing', page: 'pricing'})
.add({name: 'blog', pattern: '/blog', page: 'blog'})
.add({name: 'blog_item', pattern: '/blog/:slug', page:'blog_item'})
.add({name: 'login', pattern: '/login', page:'login'})
.add({name: 'signup', pattern: '/signup', page:'signup'})
.add({name: 'reset', pattern: '/reset', page: 'reset'})
.add({name: 'auth', pattern: '/auth', page: 'auth'})
.add({name: 'equipments', pattern: '/profile/equipments', page: 'equipments'})
.add({name: 'connections', pattern: '/profile/connections', page: 'connections'})
.add({name: 'passwordreset', pattern: '/password/reset', page: 'passwordreset'})
.add({name: 'about', pattern: '/profile/about', page: 'about'})"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">routes</span> <span class="pl-c1">=</span> <span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'next-routes'</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-s1">routes</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'community'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/community'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'profiles'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'locations'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/community/locations'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'locations'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'categories'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/community/categories'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'categories'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'talents'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/community/talents'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'talents'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>:<span class="pl-s">'dashboard'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/dashboard'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'dashboard'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>:<span class="pl-s">'pricing'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/pricing'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'pricing'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'blog'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/blog'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'blog'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'blog_item'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/blog/:slug'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>:<span class="pl-s">'blog_item'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'login'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/login'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>:<span class="pl-s">'login'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'signup'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/signup'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>:<span class="pl-s">'signup'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'reset'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/reset'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'reset'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'auth'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/auth'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'auth'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'equipments'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/profile/equipments'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'equipments'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'connections'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/profile/connections'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'connections'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'passwordreset'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/password/reset'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'passwordreset'</span><span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">.</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">name</span>: <span class="pl-s">'about'</span><span class="pl-kos">,</span> <span class="pl-c1">pattern</span>: <span class="pl-s">'/profile/about'</span><span class="pl-kos">,</span> <span class="pl-c1">page</span>: <span class="pl-s">'about'</span><span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<h3 dir="auto">server.js</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const express = require('express');
const compression = require('compression');
const next = require('next');

const http = require('http');

const dev = process.env.NODE_ENV !== 'production';
const PORT = process.env.PORT || 3000;

const app = next({dev });

const routes = require('./routes')
const handler = routes.getRequestHandler(app, ({req, res, route, query}) =&gt; {

    app.render(req, res, route.page, query)
})

app.prepare().then(() =&gt; {

    const server = express()
    
    if (process.env.NODE_ENV === &quot;production&quot;) {
        //server.use( compression() );
    }

    server.use( handler )
    
    var httpServer = http.createServer(server);

    httpServer.listen(PORT, (err) =&gt; {
        if (err) throw err;
        console.log(`&gt; Ready on http://localhost:${PORT}`); 
    });
});"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">express</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'express'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-s1">compression</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'compression'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-s1">next</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'next'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">http</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'http'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">dev</span> <span class="pl-c1">=</span> <span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">env</span><span class="pl-kos">.</span><span class="pl-c1">NODE_ENV</span> <span class="pl-c1">!==</span> <span class="pl-s">'production'</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-c1">PORT</span> <span class="pl-c1">=</span> <span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">env</span><span class="pl-kos">.</span><span class="pl-c1">PORT</span> <span class="pl-c1">||</span> <span class="pl-c1">3000</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-s1">next</span><span class="pl-kos">(</span><span class="pl-kos">{</span>dev <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-s1">routes</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'./routes'</span><span class="pl-kos">)</span>
<span class="pl-k">const</span> <span class="pl-s1">handler</span> <span class="pl-c1">=</span> <span class="pl-s1">routes</span><span class="pl-kos">.</span><span class="pl-en">getRequestHandler</span><span class="pl-kos">(</span><span class="pl-s1">app</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">{</span>req<span class="pl-kos">,</span> res<span class="pl-kos">,</span> route<span class="pl-kos">,</span> query<span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>

    <span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">render</span><span class="pl-kos">(</span><span class="pl-s1">req</span><span class="pl-kos">,</span> <span class="pl-s1">res</span><span class="pl-kos">,</span> <span class="pl-s1">route</span><span class="pl-kos">.</span><span class="pl-c1">page</span><span class="pl-kos">,</span> <span class="pl-s1">query</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span>

<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">prepare</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>

    <span class="pl-k">const</span> <span class="pl-s1">server</span> <span class="pl-c1">=</span> <span class="pl-s1">express</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">env</span><span class="pl-kos">.</span><span class="pl-c1">NODE_ENV</span> <span class="pl-c1">===</span> <span class="pl-s">"production"</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-c">//server.use( compression() );</span>
    <span class="pl-kos">}</span>

    <span class="pl-s1">server</span><span class="pl-kos">.</span><span class="pl-en">use</span><span class="pl-kos">(</span> <span class="pl-s1">handler</span> <span class="pl-kos">)</span>
    
    <span class="pl-k">var</span> <span class="pl-s1">httpServer</span> <span class="pl-c1">=</span> <span class="pl-s1">http</span><span class="pl-kos">.</span><span class="pl-en">createServer</span><span class="pl-kos">(</span><span class="pl-s1">server</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-s1">httpServer</span><span class="pl-kos">.</span><span class="pl-en">listen</span><span class="pl-kos">(</span><span class="pl-c1">PORT</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">err</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">err</span><span class="pl-kos">)</span> <span class="pl-k">throw</span> <span class="pl-s1">err</span><span class="pl-kos">;</span>
        <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">`&gt; Ready on http://localhost:<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-c1">PORT</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">)</span><span class="pl-kos">;</span> 
    <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">next.config.js</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const withSass = require('@zeit/next-sass')

const getRoutes = require('./src/routes')

module.exports = withSass({
    cssModules: false, 

	exportPathMap: getRoutes, 
	useFileSystemPublicRoutes: false
})"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">withSass</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'@zeit/next-sass'</span><span class="pl-kos">)</span>

<span class="pl-k">const</span> <span class="pl-s1">getRoutes</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'./src/routes'</span><span class="pl-kos">)</span>

<span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-s1">withSass</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
    <span class="pl-c1">cssModules</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span> 

	<span class="pl-c1">exportPathMap</span>: <span class="pl-s1">getRoutes</span><span class="pl-kos">,</span> 
	<span class="pl-c1">useFileSystemPublicRoutes</span>: <span class="pl-c1">false</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<h3 dir="auto">package.json</h3>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;scripts&quot;: {
    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;,
    &quot;dev&quot;: &quot;node ./src/server.js&quot;,
    &quot;build&quot;: &quot;next build&quot;,
    &quot;start&quot;: &quot;node ./src/server.js -p $PORT&quot;,
    &quot;heroku-postbuild&quot;: &quot;next build&quot;
  },"><pre class="notranslate"><span class="pl-ent">"scripts"</span>: {
    <span class="pl-ent">"test"</span>: <span class="pl-s"><span class="pl-pds">"</span>echo <span class="pl-cce">\"</span>Error: no test specified<span class="pl-cce">\"</span> &amp;&amp; exit 1<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"dev"</span>: <span class="pl-s"><span class="pl-pds">"</span>node ./src/server.js<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"build"</span>: <span class="pl-s"><span class="pl-pds">"</span>next build<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"start"</span>: <span class="pl-s"><span class="pl-pds">"</span>node ./src/server.js -p $PORT<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"heroku-postbuild"</span>: <span class="pl-s"><span class="pl-pds">"</span>next build<span class="pl-pds">"</span></span>
  },</pre></div>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues?q=is%3Aissue">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">I expect the app to run flawlessly because it works on development.</p>
<h2 dir="auto">Environment</h2>
<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>6.0.0</td>
</tr>
<tr>
<td>node</td>
<td>v8.9.1</td>
</tr>
<tr>
<td>OS</td>
<td>Mac OS X Sierra</td>
</tr>
<tr>
<td>browser</td>
<td>All</td>
</tr>
<tr>
<td>deployed</td>
<td>heroku</td>
</tr>
</tbody>
</table>
<p dir="auto"><code class="notranslate">npm install next</code> fails with error:<br>
<code class="notranslate">npm ERR! 404 Not Found: @zeit/check-updates@1.1.0</code></p>


<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>


<h2 dir="auto">Current Behavior</h2>


<h2 dir="auto">Steps to Reproduce (for bugs)</h2>


<ol dir="auto">
<li>Following instructions here: <a href="https://learnnextjs.com/basics/getting-started/setup" rel="nofollow">https://learnnextjs.com/basics/getting-started/setup</a></li>
<li><code class="notranslate">npm install next</code> should succeed</li>
<li></li>
<li></li>
</ol>
<h2 dir="auto">Context</h2>


<h2 dir="auto">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>5.6.0</td>
</tr>
<tr>
<td>node</td>
<td>9.5.0</td>
</tr>
<tr>
<td>OS</td>
<td>OSX 10.12.6</td>
</tr>
<tr>
<td>browser</td>
<td></td>
</tr>
<tr>
<td>etc</td>
<td></td>
</tr>
</tbody>
</table>