【问题标题】:Angular create project results in various console warningsAngular 创建项目导致各种控制台警告
【发布时间】:2020-03-04 10:31:02
【问题描述】:

之前类似帖子给出的解决方案对我不起作用。

我是 Angular 开发的新手,正在尝试从头开始学习。我在尝试创建我的第一个应用时遇到了问题。

环境

  1. Windows 10

  2. 使用 GitBash 安装 Angular 最新版本

  3. 节点版本:v12.14.0

  4. NPM 版本:6.13.4

  5. Angular CLI 版本:8.3.21

问题

  1. 给出安装新项目的命令。

新测试

  1. 一段时间后它会产生以下错误。

    npm WARN deprecated core-js@2.6.11: core-js@

  2. 我试图退出。但是经过不同的帖子后,我才知道,安装将毫无问题地进行。我跟着它。终于安装成功了。

  3. 但在成功安装消息之前,它会在 core-js 安装后生成大量消息、npm WARN、0 漏洞、警告等。

这是最后的信息。

npm WARN karma-jasmine-html-reporter@1.5.1 requires a peer of jasmine-core@>=3.5 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\karma\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\@angular\compiler-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1193 packages from 1051 contributors and audited 18835 packages in 279.874s

21 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

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.



 ng serve
i ?wds?: Project is running at http://localhost:4200/webpack-dev-server/
i ?wds?: webpack output is served from /
i ?wds?: 404s will fallback to //index.html

chunk {main} main.js, main.js.map (main) 47.8 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 9.71 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.81 MB [initial] [rendered]
Date: 2019-12-26T14:34:42.939Z - Hash: 697612d9c3732f0363f0 - Time: 11060ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i ?wdm?: Compiled successfully.
i ?wdm?: Compiling...

Date: 2019-12-26T14:51:49.861Z - Hash: 697612d9c3732f0363f0
5 unchanged chunks

Time: 14395ms
i ?wdm?: Compiled successfully.

我想知道为什么会出现这样的 core-js 和其他问题。我的系统和环境是否有任何故障。或者,NodeJS 上存在一些安装问题。或者,这是一个简单而被忽视的问题,任何人都可能发生。

【问题讨论】:

  • 请检查您的 package.json。我认为有些软件包没有安装。
  • 这里没有什么要解决的。这些都是警告。继续前进。

标签: node.js angular npm angular-cli


【解决方案1】:

尝试在您的项目中运行npm update

【讨论】:

  • 我已经更新了npm,但仍然没有任何改进。最初我没有这个警告,但几天前,它发生了。我担心的是为什么会发生这种情况以及如何克服。
  • 不管警告如何,它都能正常工作。
【解决方案2】:

我自己对此很陌生-但做了一些挖掘。发现一个由 Angular CLI 人员记录的错误: https://github.com/angular/angular-cli/issues/16576

已修复,但我认为这是在主要版本 9 RC-7 中。 如果您致力于使用 8 直到 9 稳定,那么很高兴知道该怎么做...

【讨论】:

    猜你喜欢
    • 2017-10-18
    • 2015-04-11
    • 1970-01-01
    • 2019-08-17
    • 1970-01-01
    • 2014-10-30
    • 1970-01-01
    • 2020-01-13
    • 2019-01-03
    相关资源
    最近更新 更多