WebStorm:新的AngularCli项目:错误:目录应该匹配格式"路径"

时间:2018-03-28 21:48:10

标签: directory angular-cli webstorm new-project

当我尝试创建一个新的 Angular Cli 项目时:

enter image description here

在IDE执行ng new angularcli --dir=.命令几秒钟后收到此消息(在运行窗口中):

"C:\Program Files\nodejs\node.exe" C:\Users\I\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng new angularcli --dir=.
Error: Schematic input does not validate against the Schema: {"directory":".","name":"angularcli","skipGit":false,"style":"css","version":"1.7.3","commit":{"message":"chore: initial commit from @angular/cli\n\n    _                      _                 ____ _     ___\n   / \\   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|\n  / △ \\ | '_ \\ / _\\` | | | | |/ _\\` | '__|   | |   | |    | |\n / ___ \\| | | | (_| | |_| | | (_| | |      | |___| |___ | |\n/_/   \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_|       \\____|_____|___|\n               |___/\n","name":"Angular CLI","email":"angular-cli@angular.io"},"path":"app","sourceDir":"src","inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","skipTests":false,"skipInstall":false,"linkCli":false,"minimal":false,"serviceWorker":false}
Errors:
  .directory should match format "path"
Schematic input does not validate against the Schema: {"directory":".","name":"angularcli","skipGit":false,"style":"css","version":"1.7.3","commit":{"message":"chore: initial commit from @angular/cli\n\n    _                      _                 ____ _     ___\n   / \\   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|\n  / △ \\ | '_ \\ / _\\` | | | | |/ _\\` | '__|   | |   | |    | |\n / ___ \\| | | | (_| | |_| | | (_| | |      | |___| |___ | |\n/_/   \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_|       \\____|_____|___|\n               |___/\n","name":"Angular CLI","email":"angular-cli@angular.io"},"path":"app","sourceDir":"src","inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","skipTests":false,"skipInstall":false,"linkCli":false,"minimal":false,"serviceWorker":false}
Errors:
  .directory should match format "path"
Done

同样在Mac上: enter image description here

这似乎与命令的这一部分有关:--dir=.。但我不知道为什么以及如何纠正它!

(我知道我可以通过命令行独立创建一个新项目,然后在WebStorm中打开它,但出于某些原因不想这样做。)

4 个答案:

答案 0 :(得分:8)

这是一个已知的cli 1.7.x问题 - https://github.com/angular/angular-cli/issues/9655;遗憾的是,到目前为止,我们无法解决这个问题......我们正在与Angular团队合作,请关注WEB-31291进行更新。 作为解决方法,您可以尝试使用ng new <project_name>在终端中创建新的角度应用程序,然后在WebStorm中打开生成的项目文件夹

答案 1 :(得分:1)

不包括项目名称特殊字符。例如,这是错误的:www_testProject。

这是正确的:wwwTestProject

答案 2 :(得分:0)

我有这个问题,但是我有一个对我有用的解决方案是:

maxrow = Sheets("..name..").UsedRange.Rows(Sheets("..name..").UsedRange.Rows.Count).Row

无效- New project names must start with a letter, and must contain only alphanumeric characters or dashes. When adding a dash the segment after the dash must also start with a letter

有效- new_something

答案 3 :(得分:0)

根据我的上次测试,没有问题。我升级了工具(Angular CLI current_number = 1 for i, num in enumerate(a): if num == 1: a[i] = current_number current_number += 1 和WebStorm v7.1.4):

enter image description here

enter image description here