title: Node.js app runs locally but fails on docker (sh: 1: rimraf: not found)
body: <p>I am able to build the docker image but can't get the container to run. Here is the package.json:</p>
  <pre><code>{
    &quot;name&quot;: &quot;linked-versions-viewer&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;...&quot;,
    &quot;main&quot;: &quot;./dist/bundle.js&quot;,
    &quot;type&quot;: &quot;module&quot;,
  
    &quot;scripts&quot;: {
      &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;,
      &quot;clean&quot;: &quot;rimraf dist&quot;,
      &quot;build_only&quot;: &quot;rollup -c&quot;,
      &quot;build&quot;: &quot;cross-env NODE_ENV=production npm run clean &amp;&amp; npm run build_only&quot;,
      &quot;serve&quot;: &quot;parcel src/index.html --port 12345&quot;,
      &quot;start&quot;: &quot;npm run clean &amp;&amp; npm run serve&quot;
    },
    &quot;repository&quot;: {
      &quot;type&quot;: &quot;git&quot;,
      &quot;url&quot;: &quot;...&quot;
    },
    &quot;author&quot;: &quot;...&quot;,
    &quot;license&quot;: &quot;...&quot;,
    &quot;dependencies&quot;: {
      &quot;antd&quot;: &quot;^4.12.3&quot;,
      &quot;base-widget&quot;: &quot;...&quot;,
      &quot;react&quot;: &quot;^17.0.2&quot;,
      &quot;react-dom&quot;: &quot;^17.0.1&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@types/node&quot;: &quot;^14.14.28&quot;,
      &quot;@types/react&quot;: &quot;^17.0.2&quot;,
      &quot;@types/react-dom&quot;: &quot;^17.0.1&quot;,
      &quot;cross-env&quot;: &quot;^7.0.3&quot;,
      &quot;parcel-bundler&quot;: &quot;^1.12.4&quot;,
      &quot;rev-hash&quot;: &quot;^3.0.0&quot;,
      &quot;rimraf&quot;: &quot;^3.0.2&quot;,
      &quot;rollup&quot;: &quot;^2.39.0&quot;,
      &quot;rollup-plugin-commonjs&quot;: &quot;^10.1.0&quot;,
      &quot;rollup-plugin-node-resolve&quot;: &quot;^5.2.0&quot;,
      &quot;rollup-plugin-replace&quot;: &quot;^2.2.0&quot;,
      &quot;rollup-plugin-terser&quot;: &quot;^7.0.2&quot;,
      &quot;rollup-plugin-typescript2&quot;: &quot;^0.29.0&quot;,
      &quot;rollup-plugin-uglify&quot;: &quot;^6.0.4&quot;,
      &quot;typescript&quot;: &quot;^4.1.5&quot;
    }
  }
  </code></pre>
  <p>Here is the dockerfile:</p>
  <pre><code>FROM node:14.17.0 as base
  
  ENV NODE_ENV=production
  
  WORKDIR /app
  
  COPY package*.json ./
  
  RUN npm install
  
  COPY . .
  
  EXPOSE 8080
  
  FROM base as production
  
  ENV NODE_PATH=./build
  
  CMD [&quot;npm&quot;, &quot;start&quot;]
  </code></pre>
  <p>I created the image by running <code>docker build -t testapp .</code> and tried running the container with <code>docker run -p 8080:8080 -d testapp</code> but it keeps immediately exiting with code 1. This is the error log for the image:</p>
  <pre><code>&gt; linked-versions-viewer@1.0.0 start /app
  &gt; npm run clean &amp;&amp; npm run serve
  
  
  &gt; linked-versions-viewer@1.0.0 clean /app
  &gt; rimraf dist
  
  sh: 1: rimraf: not found
  npm ERR! code ELIFECYCLE
  npm ERR! syscall spawn
  npm ERR! file sh
  npm ERR! errno ENOENT
  npm ERR! linked-versions-viewer@1.0.0 clean: `rimraf dist`
  npm ERR! spawn ENOENT
  npm ERR!
  npm ERR! Failed at the linked-versions-viewer@1.0.0 clean script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /root/.npm/_logs/2021-06-09T20_40_17_204Z-debug.log
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! linked-versions-viewer@1.0.0 start: `npm run clean &amp;&amp; npm run serve`
  npm ERR! Exit status 1
  npm ERR!
  npm ERR! Failed at the linked-versions-viewer@1.0.0 start script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  </code></pre>
  <p>I tried just removing the rimraf dependency altogether but then got a similar error for the parcel dependency, so maybe the packages aren't being installed properly? The app is also written in typescript if that's helpful.</p>
  <p>Not sure what to try next. Thank you for any suggestions.</p>