<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Bight</title>
	<subtitle></subtitle>
	<link href="https://bight.dev/feed.xml" rel="self"/>
	<link href="https://bight.dev/"/>
	<updated>2021-04-17T17:23:49+00:00</updated>
	<id>https://bight.dev</id>
	<author>
  <name>Ned Zimmerman</name>
  <email>ned@bight.dev</email>
	</author>
	
  
  <entry>
    <title>Deploying a SvelteKit application to Heroku</title>
    <link href="https://bight.dev/log/deploying-a-sveltekit-application-to-heroku/"/>
    <updated>2021-04-17T17:23:49+00:00</updated>
    <id>https://bight.dev/log/deploying-a-sveltekit-application-to-heroku/</id>
    <content type="html"><![CDATA[
      <p>I've been a fan of <a href="https://svelte.dev">Svelte</a> for a few years now, so I'm very excited about <a href="https://kit.svelte.dev/">SvelteKit</a>.</p>
<p>I've begun migrating an existing Node + Express project that's hosted on Heroku to SvelteKit, and I couldn't find any clear instructions about how to make the deployment work using SvelteKit's <a href="https://github.com/sveltejs/kit/tree/master/packages/adapter-node">Node adapter</a>.</p>
<p>At first I encountered an error about <code>svelte-kit</code> not being found. This turned out to be Heroku helpfully pruning <code>devDependencies</code>, which removes <code>@sveltejs/kit</code> from the built application. I <a href="https://devcenter.heroku.com/articles/nodejs-support#skip-pruning">disabled this behaviour</a> by setting the <code>NPM_CONFIG_PRODUCTION</code> variable to <code>false</code>:</p>
<pre class="language-bash"><code class="language-bash">$ heroku config:set <span class="token assign-left variable">NPM_CONFIG_PRODUCTION</span><span class="token operator">=</span>false</code></pre>
<p>Then, while the app deployed successfully, it kept crashing with an <a href="https://help.heroku.com/P1AVPANS/why-is-my-node-js-app-crashing-with-an-r10-error">R10 error</a> shortly after launch. It turns out that the <code>Procfile</code> must be set to the following (assuming that your <code>start</code> script runs <code>svelte-kit start</code>):</p>
<pre><code>web: npm run start -- --port $PORT --host 0.0.0.0
</code></pre>
<p>I hope this is helpful for anyone else trying to achieve the same thing.</p>

    ]]></content>
  </entry>
	
</feed>
