我使用以下方法启动了 Nx 工作区npx
:
npx create-nx-workspace
在 nx 完成引导我的工作区后,我得到了这个:
This means that you might have to use "yarn nx" or "npx nx" to execute command
s in the workspace.
Run "yarn global add nx" or "npm install -g nx" to be able to execute command
directly.
我想直接执行命令并想使用纱线:
yarn global add nx
并获得成功消息:
yarn global v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "nx@12.5.8" with binaries:
- nx
Done in 9.40s.
我 cd 进入我的工作区,并尝试使用我之前安装的 nx cli 为我的“todos”应用程序提供服务:
cd myorg
nx serve todos
但我收到此错误:
bash: nx: command not found
我重新启动了终端并serve
再次尝试但得到了同样的错误。serve
如果我这样做的话就可以工作yarn nx serve todos
,但是,我很想了解为什么以及如何使直接命令与 Yarn 一起工作。