【问题标题】:Yarn install error: NX Cannot read properties of undefined (reading 'endsWith')纱线安装错误:NX 无法读取未定义的属性(读取“endsWith”)
【发布时间】:2022-07-15 16:29:16
【问题描述】:

我正在尝试在 NX 工作区中为 react 应用设置 circeci。

  • 在执行yarn install的步骤上
  • 我收到下一个错误:

错误 /home/circleci/project/node_modules/@nrwl/js/node_modules/nx, /home/circleci/project/node_modules/@nrwl/remix/node_modules/nx: 命令失败。退出代码:1 命令:node ./bin/init 参数: 目录: /home/circleci/project/node_modules/@nrwl/js/node_modules/nx 输出:

NX 无法读取未定义的属性(读取“endsWith”)信息访问https://yarnpkg.com/en/docs/cli/install 获取有关文档 这个命令。

以代码退出状态 1 退出

这是我的 circeci 配置

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 << parameters.ordinal >>
          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 << matrix.ordinal >>
          matrix:
            parameters:
              ordinal: [1, 2, 3]
      - main:
          name: Nx Cloud Main

有人遇到过类似的问题吗?

【问题讨论】:

    标签: javascript reactjs continuous-integration nomachine-nx


    【解决方案1】:

    我多次遇到这个问题。 只需删除 node_modules 中的“.cache/nx”文件夹并重新运行您的命令。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-07-06
      • 2022-01-03
      • 2021-12-31
      • 2022-10-05
      • 2020-05-27
      • 1970-01-01
      • 2022-07-03
      • 2022-12-24
      相关资源
      最近更新 更多