title: Yarn install error: NX Cannot read properties of undefined (reading 'endsWith')
body: <p>I am trying to setup circeci in NX workspace for react app.</p>
  <ul>
  <li>On the step where is executed <code>yarn install</code></li>
  <li>I get next error:</li>
  </ul>
  <blockquote>
  <p>error /home/circleci/project/node_modules/@nrwl/js/node_modules/nx,
  /home/circleci/project/node_modules/@nrwl/remix/node_modules/nx:
  Command failed. Exit code: 1 Command: node ./bin/init Arguments:
  Directory:
  /home/circleci/project/node_modules/@nrwl/js/node_modules/nx Output:</p>
  <blockquote>
  <p>NX   Cannot read properties of undefined (reading 'endsWith') info Visit <a href="https://yarnpkg.com/en/docs/cli/install" rel="nofollow noreferrer">https://yarnpkg.com/en/docs/cli/install</a> for documentation about
  this command.</p>
  </blockquote>
  <p>Exited with code exit status 1</p>
  </blockquote>
  <p>This is my circeci config</p>
  <pre><code>version: 2.1
  
  orbs:
    nx: nrwl/nx@1.4.0
  
  jobs:
    agent:
      resource_class: xlarge
      docker:
        - image: cimg/node:lts-browsers
      parameters:
        ordinal:
          type: integer
      steps:
        - checkout
        - run:
            name: Install dependencies
            command: | 
              yarn install 
        - run:
            name: Start the agent &lt;&lt; parameters.ordinal &gt;&gt;
            command: yarn nx-cloud start-agent
            no_output_timeout: 60m
    main:
      resource_class: xlarge
      docker:
        - image: cimg/node:lts-browsers
      environment:
        NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
      steps:
        - checkout
        - run:
            name: Install dependencies
            command: |
              yarn install 
        - nx/set-shas:
            main-branch-name: 'main'
        - run:
            name: Initialize the Nx Cloud distributed CI run
            command: yarn nx-cloud start-ci-run
        - run:
            name: Run workspace lint
            command: yarn nx-cloud record -- yarn nx workspace-lint
        - run:
            name: Check format
            command: yarn nx-cloud record -- yarn nx format:check --base=$NX_BASE --head=$NX_HEAD
        - run:
            name: Run lint
            command: yarn nx affected --base=$NX_BASE --head=$NX_HEAD --target=lint --parallel=3
        - run:
            name: Run test
            command: yarn nx affected --base=$NX_BASE --head=$NX_HEAD --target=test --parallel=3 --ci --code-coverage
        - run:
            name: Run build
            command: yarn nx affected --base=$NX_BASE --head=$NX_HEAD --target=build --parallel=3
        - run:
            name: Stop all agents
            command: yarn nx-cloud stop-all-agents
            when: always
  
  workflows:
    version: 2
  
    ci:
      jobs:
        - agent:
            name: Nx Cloud Agent &lt;&lt; matrix.ordinal &gt;&gt;
            matrix:
              parameters:
                ordinal: [1, 2, 3]
        - main:
            name: Nx Cloud Main
  </code></pre>
  <p>Does anyone had similar problem?</p>