<p>My node.js kubernetes dev server is stuck in a crash loop. The logs show:</p>
<pre><code>/bin/busybox:1
ELF
^
SyntaxError: Invalid or unexpected token
    at wrapSafe (internal/modules/cjs/loader.js:992:16)
    at Module._compile (internal/modules/cjs/loader.js:1040:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:941:32)
    at Function.Module._load (internal/modules/cjs/loader.js:776:16)
    at Function.executeUserEntryPoint [as runMain (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
stream closed                                                                                                                          
</code></pre>
<p>I found the image that's running via <code>kubectl describe</code> and ran it in a shell. It ought to be running this (from the <code>Dockerfile</code>):</p>
<pre><code>...
ENTRYPOINT [&quot;node&quot;, &quot;--max-old-space-size=4096&quot;, &quot;--enable-source-maps&quot;]
CMD ['node_modules/.bin/rollup','-cw']
</code></pre>
<p>So in the shell I ran:</p>
<pre><code>❯ dsh myregistry/project/server:R4SUGQt
+dsh:1&gt; docker run --rm -it --entrypoint sh myregistry/project/server:R4SUGQt -c '{ command -v zsh &amp;&amp; exec zsh -il ;} || { command -v bash &amp;&amp; bash -il ;} || { command -v ash &amp;&amp; ash -il ;}'
/bin/ash
06884c20d5cc:/app# node --max-old-space-size=4096 --enable-source-maps node_modules/.bin/rollup -cw

</code></pre>
<p>And it works perfectly. So where's that error stemming from? All the paths in the stack trace internal (<code>internal/modules/...</code>) not from my script or rollup.</p>
<p>I'm using <code>node:alpine</code> as my base image which is currently on Node v14.11.0.</p>
<hr />
<p>Running it directly</p>
<pre><code>docker run --rm myregistry/project/server:R4SUGQ
</code></pre>
<p><strong>does</strong> reproduce the error.</p>
<hr />
<p>Running</p>
<pre><code>docker run -it myregistry/project/server:R4SUGQt node_modules/.bin/rollup -cw
</code></pre>
<p>Works fine... is there something wrong with my <code>CMD</code> syntax?</p>
<pre><code>CMD ['node_modules/.bin/rollup','-cw']
</code></pre>

mpen
<p>It was the single quotes I used in the <code>CMD</code>.</p>
<p>Found this reddit post after the fact: <a href="https://www.reddit.com/r/docker/comments/9wn5gw/be_aware_of_the_quotes_in_your_dockerfile/" rel="nofollow noreferrer">https://www.reddit.com/r/docker/comments/9wn5gw/be_aware_of_the_quotes_in_your_dockerfile/</a></p>
<p>What a waste of time... leaving this question here in case someone else hits a similar error, maybe it'll be Googlable for them.</p>
