'nx' 未被识别为 cmdlet 的名称

'nx' is not recognized as the name of a cmdlet

我正在尝试将一个新的实用程序库添加到我的 Nx 单声道存储库中。我用谷歌搜索并从 www.nx.dev 中找到了以下命令:

nx generate @nrwl/nest:library util/util-myLibName

当我运行执行上述命令时,我收到以下消息:

The term 'nx' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

我在网上搜索了很多,但找不到解决方案。

这是因为您的 s.o

中没有安装 nx

先试试

npm install -g @nrwl/cli

尝试

npx nx generate @nrwl/nest:library util/util-myLibName

我从本地包文件中得到 运行:

./node_modules/.bin/nx

迁移示例: ./node_modules/.bin/nx migrate latest

我这样做是因为全局安装 @nrwl/cli 对我不起作用。