【问题标题】:Problem when creating a new angular project in cli using npm on windows在 Windows 上使用 npm 在 cli 中创建新的 Angular 项目时出现问题
【发布时间】:2020-05-01 23:54:49
【问题描述】:

所以我正在学习 udemy 角度课程,而我在使用 windows 时,讲师正在使用 mac。当我创建一个新项目时,我从他那里得到不同的屏幕是正常的还是我错过了什么。屏幕已附上,我的是黑屏。I get a series of create commands followed by a series of warnings

its followed by a successfully initialized git

he gets a series of create also

But is followed by series of installs

    A:\Work\Projects> ng new first-website
? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? CSS
CREATE first-website/angular.json (3622 bytes)
CREATE first-website/package.json (1289 bytes)
CREATE first-website/README.md (1029 bytes)
CREATE first-website/tsconfig.json (489 bytes)
CREATE first-website/tslint.json (3125 bytes)
CREATE first-website/.editorconfig (274 bytes)
CREATE first-website/.gitignore (631 bytes)
CREATE first-website/browserslist (429 bytes)
CREATE first-website/karma.conf.js (1025 bytes)
CREATE first-website/tsconfig.app.json (210 bytes)
CREATE first-website/tsconfig.spec.json (270 bytes)
CREATE first-website/src/favicon.ico (948 bytes)
CREATE first-website/src/index.html (298 bytes)
CREATE first-website/src/main.ts (372 bytes)
CREATE first-website/src/polyfills.ts (2835 bytes)
CREATE first-website/src/styles.css (80 bytes)
CREATE first-website/src/test.ts (753 bytes)
CREATE first-website/src/assets/.gitkeep (0 bytes)
CREATE first-website/src/environments/environment.prod.ts (51 bytes)
CREATE first-website/src/environments/environment.ts (662 bytes)
CREATE first-website/src/app/app.module.ts (314 bytes)
CREATE first-website/src/app/app.component.html (25725 bytes)
CREATE first-website/src/app/app.component.spec.ts (963 bytes)
CREATE first-website/src/app/app.component.ts (217 bytes)
CREATE first-website/src/app/app.component.css (0 bytes)
CREATE first-website/e2e/protractor.conf.js (808 bytes)
CREATE first-website/e2e/tsconfig.json (214 bytes)
CREATE first-website/e2e/src/app.e2e-spec.ts (646 bytes)
CREATE first-website/e2e/src/app.po.ts (301 bytes)
√ Packages installed successfully.
warning: LF will be replaced by CRLF in .editorconfig.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in angular.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in browserslist.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/protractor.conf.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/src/app.e2e-spec.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/src/app.po.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/tsconfig.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in karma.conf.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in package-lock.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in package.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.spec.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.module.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/environments/environment.prod.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/environments/environment.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/index.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/main.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/polyfills.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/styles.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/test.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.app.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.spec.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tslint.json.
The file will have its original line endings in your working directory
    Successfully initialized git.

【问题讨论】:

    标签: angular git npm command-line-interface


    【解决方案1】:

    我认为使用两个字节进行换行是 Windows 的标准。

    这只是意味着创建的文件将被修改以更好地适应您正在使用的操作系统的标准。

    没什么好担心的。

    【讨论】:

      【解决方案2】:

      您可以忽略这些警告。据我所知,它们与 git 有关。几个月前我参加他的 Angular 课程时,我在使用 Win 10 Pro 时没有遇到任何问题。

      您是否使用 vs code 终端进行 cli/npm 安装?

      以下是他的课程内容 1.5 中有关安装故障排除的信息:

      确保您使用的是最新版本,从而解决了很多问题 NodeJS、npm 和 CLI 本身的版本。

      更新 NodeJS:

      去nodejs.org下载最新版本——卸载(全部) 首先在您的机器上安装版本。

      更新 npm:

      运行 [sudo] npm install -g npm(sudo 仅在 Mac/Linux 上需要)

      更新 CLI

      [sudo]npm uninstall -g angular-cli@angular/cli

      npm 缓存验证

      [sudo]npm install -g@angular/cli

      以下是一些常见问题和解决方案:

      创建一个新项目需要很长时间(超过 3 分钟) 在 Windows 上不时发生 => 尝试运行命令行 作为管理员

      您收到 EADDR 错误(地址已在使用中)您可能已经有 另一个 ng 服务进程正在运行 - 确保退出该进程或使用 ng serve --port ANOTHERPORT 在新端口上为您的项目提供服务

      我的更改未反映在浏览器中(应用程序未编译) 检查运行 ng serve 的窗口是否显示错误。如果那不是 在这种情况下,请确保您使用的是最新的 CLI 版本并尝试 重启你的 CLI

      希望对你有帮助

      【讨论】:

      • 所以我应该忽略这个警告并开始处理项目还是缺少什​​么?提前致谢
      • 关于此特定警告,您可以在this thread 中回答。但是,如果我想用几句话来总结它 - 如果您是为自己而不是为公众做项目,请忽略并继续开发您的应用程序。
      • 如果您认为我的答案回答了您的问题,请不要犹豫,将其标记为正确。干杯
      • 即使是lts版本也有同样的问题,所以我会忽略这个磨损..谢谢
      猜你喜欢
      • 2017-01-25
      • 1970-01-01
      • 1970-01-01
      • 2022-01-15
      • 2019-01-12
      • 1970-01-01
      • 2021-12-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多