1

在 Visual Studio Code 中使用 nx 控制台会出现错误:

> Executing task: ng generate @ngrx/schematics:feature --name=TestIt --no-flat --no-interactive --dry-run <

> An invalid configuration file was found ['C:\views\git\fipo_fe\angular.json']. Please delete the file before running the command. <

复制命令并在终端中使用它(在可视代码中),它工作正常。

C:\views\git\fipo_fe>ng generate @ngrx/schematics:feature --name=TestIt --no-flat --no-interactive --dry-run
Your global Angular CLI version (9.0.5) is greater than your local
version (9.0.1). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
CREATE apps/fipo/src/app/test-it/test-it.actions.ts (260 bytes)
CREATE apps/fipo/src/app/test-it/test-it.reducer.spec.ts (331 bytes)
CREATE apps/fipo/src/app/test-it/test-it.reducer.ts (390 bytes)
CREATE apps/fipo/src/app/test-it/test-it.effects.spec.ts (597 bytes)
CREATE apps/fipo/src/app/test-it/test-it.effects.ts (581 bytes)
CREATE apps/fipo/src/app/test-it/test-it.selectors.spec.ts (322 bytes)
CREATE apps/fipo/src/app/test-it/test-it.selectors.ts (226 bytes)

NOTE: The "dryRun" flag means no changes were made.

如果我删除 angular.json,我会收到消息

The generate command requires to be run in an Angular project, but a project definition could not be found.

在控制台和终端中。

我删除了 Visual Studio Code 并重新安装了它,还有 nx 控制台插件。

有人可以帮我吗?

版本信息:

NX 控制台

Name: Nx Console
Id: nrwl.angular-console
Description: Nx Console for Visual Studio Code. The user interface app for the Angular CLI
Version: 11.1.3
Publisher: nrwl
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console

视觉工作室代码

Version: 1.43.0 (user setup)
Commit: 78a4c91400152c0f27ba4d363eb56d2835f9903a
Date: 2020-03-09T19:47:57.235Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.17763
4

1 回答 1

0

解决了。

我在 powershell 配置文件中有一个定义的默认目录,其中是 node_modules 中旧版本的 angular-cli。删除了 powershell 配置文件,一切正常。

看起来 nx 控制台开始在 powershell 的默认目录中搜索 ng 命令。

于 2020-03-16T09:40:43.650 回答