Angular:在 git-bash 中创建 angular 项目时出现 ng 错误
Angular: ng error when I create an angular project in git-bash
我创建一个文件夹并在那里 运行 git-bash 命令
$ 新 ng_course
实际上我第一次尝试了这个并且它有效。但是当这个命令下载各种文件时,我删除了文件。然后我再次 运行 这个命令,但它现在不起作用。
好的,为了解决问题,我尝试了这个
我把c:\users\XXX里的文件删了.angular.json
我也试过这个命令:
npm uninstall -g @angular/cli(如果使用 Linux,请在开头添加 sudo)
npm 缓存清理 --force / npm 缓存验证
npm install -g @angular/cli
但它总是显示此消息:
Project name "ng_course" is not valid. 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. ng_course
我认为您不能在项目名称中使用 _
。而不是将名称更改为 ng-course
,一切都应该有效。错误意味着,您的项目名称只能包含字母数字字符或破折号。
我创建一个文件夹并在那里 运行 git-bash 命令
$ 新 ng_course
实际上我第一次尝试了这个并且它有效。但是当这个命令下载各种文件时,我删除了文件。然后我再次 运行 这个命令,但它现在不起作用。
好的,为了解决问题,我尝试了这个
我把c:\users\XXX里的文件删了.angular.json
我也试过这个命令:
npm uninstall -g @angular/cli(如果使用 Linux,请在开头添加 sudo)
npm 缓存清理 --force / npm 缓存验证
npm install -g @angular/cli
但它总是显示此消息:
Project name "ng_course" is not valid. 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. ng_course
我认为您不能在项目名称中使用 _
。而不是将名称更改为 ng-course
,一切都应该有效。错误意味着,您的项目名称只能包含字母数字字符或破折号。