title: jest: not found after npm install on Azure pipeline
body: <h2>Problem</h2>
  <p>I'm running this pipeline file on Azure but I'm experiencing that a package is not found. I want to run tests using Jest with the command <code>npm test</code> after installing the packages with <code>npm install</code>. Jest is in the devDependencies in the package.json, I and think that's why it's not begin installed on azure.</p>
  <pre><code>sh: 1: jest: not found
  </code></pre>
  <p><strong>pipeline.yaml:</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>parameters:
    triggerType: ''
  
  jobs:
  - job: RunTests 
    pool:
      vmImage: 'ubuntu-latest'
    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '10.x'
      displayName: 'Install Node.js'
    - script: |
        npm install -registry [[[[https://myregistryurl]]]]
      displayName: 'npm install'
    - script: npm test
      displayName: 'npm test'
  
  </code></pre>
  <p><strong>package.json</strong></p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;name&quot;: &quot;ssu-dashboard-client&quot;,
    &quot;version&quot;: &quot;2.3.1&quot;,
    &quot;description&quot;: &quot;Dashboard for operation planning&quot;,
    &quot;main&quot;: &quot;server.js&quot;,
    &quot;author&quot;: &quot;Olavstoppen&quot;,
    &quot;repository&quot;: {},
    &quot;license&quot;: &quot;MIT&quot;,
    &quot;scripts&quot;: {
      &quot;dev&quot;: &quot;cross-env NODE_ENV=development nodemon --watch webpack.config.js --watch server.js&quot;,
      &quot;dev:inspect&quot;: &quot;cross-env NODE_ENV=development nodemon --inspect server.js &quot;,
      &quot;build&quot;: &quot;cross-env NODE_ENV=production webpack --mode production&quot;,
      &quot;start&quot;: &quot;cross-env NODE_ENV=production node server.js&quot;,
      &quot;test&quot;: &quot;jest&quot;
    },
    &quot;dependencies&quot;: {
      &quot;@babel/preset-flow&quot;: &quot;^7.12.1&quot;,
      &quot;applicationinsights-js&quot;: &quot;^1.0.20&quot;,
      &quot;axios&quot;: &quot;^0.18.1&quot;,
      &quot;babel-jest&quot;: &quot;^26.6.3&quot;,
      &quot;babel-preset-jest&quot;: &quot;^26.6.2&quot;,
      &quot;color&quot;: &quot;^3.1.1&quot;,
      &quot;connected-react-router&quot;: &quot;^6.4.0&quot;,
      &quot;d3&quot;: &quot;^5.9.2&quot;,
      &quot;date-fns&quot;: &quot;^2.12.0&quot;,
      &quot;date-fns-tz&quot;: &quot;^1.0.10&quot;,
      &quot;highcharts&quot;: &quot;7.1.2&quot;,
      &quot;highcharts-drilldown&quot;: &quot;^0.1.7&quot;,
      &quot;highcharts-more&quot;: &quot;^0.1.7&quot;,
      &quot;highcharts-react-official&quot;: &quot;^2.2.2&quot;,
      &quot;history&quot;: &quot;^4.9.0&quot;,
      &quot;prop-types&quot;: &quot;^15.7.2&quot;,
      &quot;ramda&quot;: &quot;^0.26.1&quot;,
      &quot;react&quot;: &quot;^16.8.6&quot;,
      &quot;react-dom&quot;: &quot;^16.8.6&quot;,
      &quot;react-google-charts&quot;: &quot;^2.0.29&quot;,
      &quot;react-highcharts&quot;: &quot;^16.0.2&quot;,
      &quot;react-is&quot;: &quot;^16.13.1&quot;,
      &quot;react-json-tree&quot;: &quot;^0.11.2&quot;,
      &quot;react-measure&quot;: &quot;^2.3.0&quot;,
      &quot;react-redux&quot;: &quot;^7.0.3&quot;,
      &quot;react-router&quot;: &quot;^5.0.0&quot;,
      &quot;react-router-dom&quot;: &quot;^5.0.0&quot;,
      &quot;react-router-hash-link&quot;: &quot;^1.2.1&quot;,
      &quot;react-saga&quot;: &quot;^0.2.6&quot;,
      &quot;redux&quot;: &quot;^4.0.1&quot;,
      &quot;redux-logger&quot;: &quot;^3.0.6&quot;,
      &quot;redux-saga&quot;: &quot;^0.16.2&quot;,
      &quot;redux-thunk&quot;: &quot;^2.3.0&quot;,
      &quot;reselect&quot;: &quot;^4.0.0&quot;,
      &quot;sanitize-html&quot;: &quot;^2.1.2&quot;,
      &quot;styled-components&quot;: &quot;^5.2.1&quot;,
      &quot;styled-system&quot;: &quot;^5.1.5&quot;,
      &quot;tinymce&quot;: &quot;^5.4.2&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@babel/core&quot;: &quot;^7.4.4&quot;,
      &quot;@babel/plugin-proposal-class-properties&quot;: &quot;^7.12.1&quot;,
      &quot;@babel/plugin-proposal-decorators&quot;: &quot;^7.4.4&quot;,
      &quot;@babel/plugin-proposal-export-namespace-from&quot;: &quot;^7.2.0&quot;,
      &quot;@babel/plugin-proposal-function-sent&quot;: &quot;^7.2.0&quot;,
      &quot;@babel/plugin-proposal-json-strings&quot;: &quot;^7.2.0&quot;,
      &quot;@babel/plugin-proposal-numeric-separator&quot;: &quot;^7.2.0&quot;,
      &quot;@babel/plugin-proposal-throw-expressions&quot;: &quot;^7.2.0&quot;,
      &quot;@babel/plugin-syntax-dynamic-import&quot;: &quot;^7.8.3&quot;,
      &quot;@babel/plugin-syntax-import-meta&quot;: &quot;^7.2.0&quot;,
      &quot;@babel/plugin-transform-runtime&quot;: &quot;^7.4.4&quot;,
      &quot;@babel/polyfill&quot;: &quot;^7.4.4&quot;,
      &quot;@babel/preset-env&quot;: &quot;^7.12.1&quot;,
      &quot;@babel/preset-react&quot;: &quot;^7.12.5&quot;,
      &quot;@hot-loader/react-dom&quot;: &quot;^16.8.6&quot;,
      &quot;@svgr/webpack&quot;: &quot;^4.2.0&quot;,
      &quot;@testing-library/jest-dom&quot;: &quot;^5.11.6&quot;,
      &quot;@testing-library/react&quot;: &quot;^11.1.2&quot;,
      &quot;adal-node&quot;: &quot;^0.1.28&quot;,
      &quot;applicationinsights&quot;: &quot;^1.3.1&quot;,
      &quot;babel-eslint&quot;: &quot;^10.0.1&quot;,
      &quot;babel-loader&quot;: &quot;^8.0.5&quot;,
      &quot;babel-plugin-dynamic-import-node&quot;: &quot;^2.3.3&quot;,
      &quot;babel-plugin-import&quot;: &quot;^1.11.0&quot;,
      &quot;babel-plugin-styled-components&quot;: &quot;^1.10.0&quot;,
      &quot;body-parser&quot;: &quot;^1.19.0&quot;,
      &quot;connect-logger&quot;: &quot;0.0.1&quot;,
      &quot;cookie-parser&quot;: &quot;^1.4.4&quot;,
      &quot;cookie-session&quot;: &quot;^2.0.0-beta.3&quot;,
      &quot;copy-webpack-plugin&quot;: &quot;^4.6.0&quot;,
      &quot;core-js&quot;: &quot;^3.0.1&quot;,
      &quot;cross-env&quot;: &quot;^5.2.0&quot;,
      &quot;css-loader&quot;: &quot;^1.0.1&quot;,
      &quot;dotenv&quot;: &quot;^6.2.0&quot;,
      &quot;dotenv-webpack&quot;: &quot;^1.7.0&quot;,
      &quot;eslint&quot;: &quot;^5.16.0&quot;,
      &quot;eslint-config-airbnb&quot;: &quot;^17.1.0&quot;,
      &quot;eslint-config-prettier&quot;: &quot;^3.6.0&quot;,
      &quot;eslint-config-standard&quot;: &quot;^12.0.0&quot;,
      &quot;eslint-plugin-import&quot;: &quot;^2.17.2&quot;,
      &quot;eslint-plugin-jsx-a11y&quot;: &quot;^6.2.1&quot;,
      &quot;eslint-plugin-node&quot;: &quot;^7.0.1&quot;,
      &quot;eslint-plugin-promise&quot;: &quot;^4.1.1&quot;,
      &quot;eslint-plugin-react&quot;: &quot;^7.12.4&quot;,
      &quot;eslint-plugin-standard&quot;: &quot;^4.0.0&quot;,
      &quot;eslint-plugin-styled-components-config&quot;: &quot;^0.0.2&quot;,
      &quot;express&quot;: &quot;^4.16.4&quot;,
      &quot;extract-text-webpack-plugin&quot;: &quot;^4.0.0-beta.0&quot;,
      &quot;file-loader&quot;: &quot;^2.0.0&quot;,
      &quot;helmet&quot;: &quot;^3.16.0&quot;,
      &quot;html-webpack-plugin&quot;: &quot;^3.0.7&quot;,
      &quot;identity-obj-proxy&quot;: &quot;^3.0.0&quot;,
      &quot;jest&quot;: &quot;^26.6.3&quot;,
      &quot;jest-styled-components&quot;: &quot;^7.0.3&quot;,
      &quot;jest-svg-transformer&quot;: &quot;^1.0.0&quot;,
      &quot;node-sass&quot;: &quot;^4.13.0&quot;,
      &quot;nodemon&quot;: &quot;^1.19.0&quot;,
      &quot;postcss-loader&quot;: &quot;^3.0.0&quot;,
      &quot;prettier-eslint&quot;: &quot;^8.8.2&quot;,
      &quot;react-hot-loader&quot;: &quot;^4.8.4&quot;,
      &quot;redux-mock-store&quot;: &quot;^1.5.4&quot;,
      &quot;regenerator-runtime&quot;: &quot;^0.13.2&quot;,
      &quot;sass-loader&quot;: &quot;^7.0.3&quot;,
      &quot;style-loader&quot;: &quot;^0.23.1&quot;,
      &quot;terser-webpack-plugin&quot;: &quot;^1.2.3&quot;,
      &quot;url-loader&quot;: &quot;^1.1.2&quot;,
      &quot;webpack&quot;: &quot;^4.39.0&quot;,
      &quot;webpack-cli&quot;: &quot;^3.3.1&quot;,
      &quot;webpack-dev-server&quot;: &quot;^3.3.1&quot;,
      &quot;webpack-hot-middleware&quot;: &quot;^2.24.4&quot;,
      &quot;webpack-merge&quot;: &quot;^4.2.1&quot;,
      &quot;worker-loader&quot;: &quot;^2.0.0&quot;
    },
    &quot;jest&quot;: {
      &quot;globals&quot;: {
        &quot;NODE_ENV&quot;: &quot;test&quot;
      },
      &quot;transform&quot;: {
        &quot;\\.[jt]sx?$&quot;: &quot;babel-jest&quot;,
        &quot;^.+\\.svg$&quot;: &quot;jest-svg-transformer&quot;
      },
      &quot;verbose&quot;: false,
      &quot;rootDir&quot;: &quot;.&quot;,
      &quot;collectCoverageFrom&quot;: [
        &quot;**/*.{js,jsx,ts,tsx}&quot;,
        &quot;!**/*.d.ts&quot;
      ],
      &quot;moduleFileExtensions&quot;: [
        &quot;js&quot;,
        &quot;jsx&quot;,
        &quot;ts&quot;,
        &quot;tsx&quot;
      ],
      &quot;moduleNameMapper&quot;: {
        &quot;\\.(css|less|scss|sass)$&quot;: &quot;identity-obj-proxy&quot;,
        &quot;^components/(.*)$&quot;: &quot;&lt;rootDir&gt;/src/components/$1&quot;,
        &quot;^utils/(.*)$&quot;: &quot;&lt;rootDir&gt;/src/utils/$1&quot;,
        &quot;^locales(.*)$&quot;: &quot;&lt;rootDir&gt;/src/locales/$1&quot;,
        &quot;^assets(.*)$&quot;: &quot;&lt;rootDir&gt;/src/assets/$1&quot;,
        &quot;^styles/(.*)$&quot;: &quot;&lt;rootDir&gt;/src/styles/$1&quot;
      },
      &quot;modulePathIgnorePatterns&quot;: [
        &quot;./dist&quot;
      ],
      &quot;coverageDirectory&quot;: &quot;&lt;rootDir&gt;/tests/coverage/&quot;
    }
  }
  
  </code></pre>
  <p>My package.json is at the root of the project.</p>
  <h2>What I have tried</h2>
  <p>I tried what was suggested underneath, but now I'm getting</p>
  <pre><code>npm install -registry [[[[https://myregistryurl]]]]
  ========================== Starting Command Output ===========================
  ##[debug]which 'bash'
  ##[debug]found: '/bin/bash'
  ##[debug]which '/bin/bash'
  ##[debug]found: '/bin/bash'
  ##[debug]/bin/bash arg: --noprofile
  ##[debug]/bin/bash arg: --norc
  ##[debug]/bin/bash arg: /home/vsts/work/_temp/7aa1a129-08a3-43cb-8973-ce9f3c9748c4.sh
  ##[debug]exec tool: /bin/bash
  ##[debug]arguments:
  ##[debug]   --noprofile
  ##[debug]   --norc
  ##[debug]   /home/vsts/work/_temp/7aa1a129-08a3-43cb-8973-ce9f3c9748c4.sh
  /bin/bash --noprofile --norc /home/vsts/work/_temp/7aa1a129-08a3-43cb-8973-ce9f3c9748c4.sh
  npm ERR! Maximum call stack size exceeded
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/vsts/.npm/_logs/2020-12-01T09_22_16_890Z-debug.log
  ##[debug]Exit code 1 received from tool '/bin/bash'
  
  </code></pre>
  <p>Could this be because the vmImages' being created are filling up the azure cache or something?</p>
  <p>I tried adding <code>- script: npm cache clean --f</code> but this did not do anything.</p>
  <h2>Update</h2>
  <p>It seems like the error is related to the registry, where I get a bunch of 401's</p>
  <pre><code>npm http fetch GET 401 ...
  npm http fetch GET 401 ...
  npm http fetch GET 401 ...
  npm http fetch GET 401 ...
  npm http fetch GET 401 ...
  ...
  </code></pre>