<p>I'm building a Micro-services E-commerce project, I need to create a docker image for each server in my project and run them inside K8s cluster. After successfully creating images for all back-end server I tried creating a docker image for my React front-end app, every time I try creating the image this error happened.</p>
<p>Here is my docker configuration:</p>
<pre><code>FROM node:alpine
WORKDIR /src
COPY package*.json ./
RUN npm install --silent
COPY . .
CMD [&quot;npm &quot;,&quot;start&quot;];  
</code></pre>
<p>Here is the error:</p>
<pre><code>Error: Cannot find module '/src/npm '
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
</code></pre>
<p>Sometimes it throws an error like this:</p>
<pre><code>webpack output is served from content not from webpack is served from content not from webpack is served from /app/public docker
</code></pre>

<p>This is a community wiki answer posted for better visibility. Feel free to expand it.</p>
<p>To resolve described issues, steps below need to be done.</p>
<ol>
<li><p>Upgrade Dockerfile:</p>
<pre><code>WORKDIR /src
COPY package*.json ./
RUN npm install --silent
COPY . .
CMD [&quot;npm&quot;,&quot;start&quot;];
</code></pre>
</li>
<li><p>Use version 3.4.0 for <code>react-scripts</code></p>
</li>
<li><p>Add <code>stdin_open: true</code> to docker-compose file</p>
</li>
</ol>
