创建一个新的 Angular 项目日志 NPM 警告:npm WARN optional SKIPPING OPTIONAL DEPENDENCY
Posted
技术标签:
【中文标题】创建一个新的 Angular 项目日志 NPM 警告:npm WARN optional SKIPPING OPTIONAL DEPENDENCY【英文标题】:Create a new angular project logs NPM Warnings: npm WARN optional SKIPPING OPTIONAL DEPENDENCY 【发布时间】:2019-12-29 10:20:27 【问题描述】:当我创建一个新的 Angular 项目时,我从 NPM 收到这些警告:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted "os":"darwin","arch":"any" (current: "os":"linux","arch":"x64")
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted "os":"darwin","arch":"any" (current: "os":"linux","arch":"x64")
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/karma/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted "os":"darwin","arch":"any" (current: "os":"linux","arch":"x64")
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/@angular/compiler-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted "os":"darwin","arch":"any" (current: "os":"linux","arch":"x64")
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted "os":"darwin","arch":"any" (current: "os":"linux","arch":"x64")
似乎它们无关紧要,因为该项目与ng serve -o
配合得很好。有没有办法关闭这些?
这是我的ng --version
结果:
Angular CLI: 8.3.0-rc.0
Node: 12.6.0
OS: linux x64
Angular: 8.2.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.802.2
@angular-devkit/build-angular 0.802.2
@angular-devkit/build-optimizer 0.802.2
@angular-devkit/build-webpack 0.802.2
@angular-devkit/core 8.2.2
@angular-devkit/schematics 8.3.0-rc.0
@angular/cdk 8.1.3
@angular/cli 8.3.0-rc.0
@angular/material 8.1.3
@ngtools/webpack 8.2.2
@schematics/angular 8.3.0-rc.0
@schematics/update 0.803.0-rc.0
rxjs 6.4.0
typescript 3.5.3
webpack 4.38.0
【问题讨论】:
【参考方案1】:您可以尝试将这些选项添加到 npm install 命令:
--no-optional argument will prevent optional dependencies from being installed.
--no-shrinkwrap argument, which will ignore an available package lock or shrinkwrap file and use the package.json instead.
--no-package-lock argument will prevent npm from creating a package-lock.json file.
【讨论】:
以上是关于创建一个新的 Angular 项目日志 NPM 警告:npm WARN optional SKIPPING OPTIONAL DEPENDENCY的主要内容,如果未能解决你的问题,请参考以下文章
我无法使用 npm install 安装我的特定 Angular 项目之一