Jenkins npm install fails for directory A but is successful for directory B install

My Jenkinsfile is set up at root of a two directory github repo and is designed to install (npm install) packages for two sub directories (dir “frontend” and dir “backend”) inside a Docker container. Dir bakcend, a Nestjs app, installs without errors. Dir frontend, an angular app, errors during npm install and gives the following errs: “npm WARN tar ENOENT: no such file or directory…”

root
-dir backend (nestjs server)
-dir frontend (angular app)
-Jenkinsfile

Jenkinsfile snipet:

pipeline {
  agent {
    docker {
      image 'node:alpine'
      args '-p 20001-20100:3000'
    }

  }
  stages {
    stage('Build') {
          steps {

            dir('frontend') {
              sh 'npm install' <<<THIS ERRORS
              echo "install frontend end"
            }

            dir('backend') {
              sh 'npm install' <<<THIS WILL NOT ERROR
              echo "install backend end"
            }
          } 
        }
etc...

The ‘frontend’ npm install will result in an error. If I reverse the order and put the “backend” step first, it will install the backend packages without error.

I have another Jenkinsfile with a similar angular app that installs, builds and deploys without err so I do not believe it is an angular/cli issue.

Source: StackOverflow