简体   繁体   English

Angular cli 源目录选项不起作用

[英]Angular cli source directory option not working

I am trying to create the new angular-cli project with --source-dir option but its creating directory as true .我正在尝试使用--source-dir选项创建新的angular-cli项目,但其创建目录为true

Full command ng new foobar --prefix foo --style scss --routing true --skip-git true --source-dir web --dry-run完整命令ng new foobar --prefix foo --style scss --routing true --skip-git true --source-dir web --dry-run

Angular version角版

在此处输入图片说明

Output输出

在此处输入图片说明

Use this command instead:请改用此命令:

ng new foobar --prefix foo --style scss --routing true --skip-git true --source-dir=web --dry-run

You just need to put an equal ( = ) between the --source-dir and web .您只需要在--source-dirweb之间放置一个相等的 ( = )。

Output:输出:

The option '--source-dir' is not registered with the new command. Run `ng new --help` for a list of supported options.
create foobar/e2e/app.e2e-spec.ts (288 bytes)
create foobar/e2e/app.po.ts (208 bytes)
create foobar/e2e/tsconfig.e2e.json (235 bytes)
create foobar/karma.conf.js (923 bytes)
create foobar/package.json (1317 bytes)
create foobar/protractor.conf.js (722 bytes)
create foobar/README.md (1022 bytes)
create foobar/tsconfig.json (363 bytes)
create foobar/tslint.json (3040 bytes)
create foobar/.angular-cli.json (1243 bytes)
create foobar/.editorconfig (245 bytes)
create foobar/web/assets/.gitkeep (0 bytes)
create foobar/web/environments/environment.prod.ts (51 bytes)
create foobar/web/environments/environment.ts (387 bytes)
create foobar/web/favicon.ico (5430 bytes)
create foobar/web/index.html (293 bytes)
create foobar/web/main.ts (370 bytes)
create foobar/web/polyfills.ts (2405 bytes)
create foobar/web/styles.scss (80 bytes)
create foobar/web/test.ts (642 bytes)
create foobar/web/tsconfig.app.json (211 bytes)
create foobar/web/tsconfig.spec.json (304 bytes)
create foobar/web/typings.d.ts (104 bytes)
create foobar/web/app/app-routing.module.ts (245 bytes)
create foobar/web/app/app.module.ts (395 bytes)
create foobar/web/app/app.component.html (1173 bytes)
create foobar/web/app/app.component.spec.ts (1103 bytes)
create foobar/web/app/app.component.ts (208 bytes)
create foobar/web/app/app.component.scss (0 bytes)

Based on the output of the command, the --source-dir option looks like it is deprecated.根据命令的输出, --source-dir选项似乎已被弃用。 It will likely go away in the future.它可能会在未来消失。 I am not seeing a replacement for it in the --help .我在--help没有看到它的替代品。

Try this command:试试这个命令:

ng new SportsStore --skip-git --skip-tests --directory ClientApp

It would appear that the switch --source-dir was deprecated.似乎不推荐使用开关--source-dir

The previous command creates the following output:上一个命令创建以下输出:

CREATE ClientApp/angular.json (4195 bytes)
CREATE ClientApp/package.json (1286 bytes)
CREATE ClientApp/README.md (1028 bytes)
CREATE ClientApp/tsconfig.json (543 bytes)
CREATE ClientApp/tslint.json (1988 bytes)
CREATE ClientApp/.editorconfig (246 bytes)
CREATE ClientApp/.gitignore (631 bytes)
CREATE ClientApp/browserslist (429 bytes)
CREATE ClientApp/karma.conf.js (1023 bytes)
CREATE ClientApp/tsconfig.app.json (270 bytes)
CREATE ClientApp/tsconfig.spec.json (270 bytes)
CREATE ClientApp/src/favicon.ico (948 bytes)
CREATE ClientApp/src/index.html (297 bytes)
CREATE ClientApp/src/main.ts (372 bytes)
CREATE ClientApp/src/polyfills.ts (2838 bytes)
CREATE ClientApp/src/styles.css (80 bytes)
CREATE ClientApp/src/test.ts (642 bytes)
CREATE ClientApp/src/assets/.gitkeep (0 bytes)
CREATE ClientApp/src/environments/environment.prod.ts (51 bytes)
CREATE ClientApp/src/environments/environment.ts (662 bytes)
CREATE ClientApp/src/app/app.module.ts (314 bytes)
CREATE ClientApp/src/app/app.component.html (25467 bytes)
CREATE ClientApp/src/app/app.component.ts (215 bytes)
CREATE ClientApp/src/app/app.component.css (0 bytes)
CREATE ClientApp/e2e/protractor.conf.js (810 bytes)
CREATE ClientApp/e2e/tsconfig.json (214 bytes)
CREATE ClientApp/e2e/src/app.e2e-spec.ts (644 bytes)
CREATE ClientApp/e2e/src/app.po.ts (262 bytes)
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

These are the versions installed on my box:这些是安装在我的盒子上的版本:

$ node --version
v10.16.0

$ npm --version
6.9.0

Angular CLI: 8.3.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM