纱线安装错误:NX无法读取未定义的属性(Reading' Endswith')
我正在尝试在React应用程序的NX Workspace中设置Circeci。
- 在执行
纱线安装的步骤中,
- 我会得到下一个错误:
error/home/circleci/project/node_modules/@nrwl/js/node_modules/nx, /home/circleci/project/node_modules/@nrwl/remix/node_modules/nx: 命令失败。退出代码:1命令:节点./bin/init参数: 目录: /home/circleci/project/node_modules/@nrwl/js/node_modules/nx输出:
nx无法读取未定义的属性(读取'endswith')信息访问 https:// yarnpkg .com/en/doc/cli/install 用于文档 此命令。
带有代码退出状态1
退出
这是我的Circeci配置,
version: 2.1
orbs:
nx: nrwl/[email protected]
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
有人有类似的问题吗?
I am trying to setup circeci in NX workspace for react app.
- On the step where is executed
yarn install
- I get next error:
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:NX Cannot read properties of undefined (reading 'endsWith') info Visit https://yarnpkg.com/en/docs/cli/install for documentation about
this command.Exited with code exit status 1
This is my circeci config
version: 2.1
orbs:
nx: nrwl/[email protected]
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
Does anyone had similar problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很多次都解决了这个问题。
只需删除node_modules中的“ .cache/nx”文件夹,然后重新运行命令。
I encount this issue a lot of times.
Just remove the ".cache/nx" folder in your node_modules and re-run your command.