安装软件包并发出警告消息

时间:2020-10-30 11:03:34

标签: npm visual-studio-code package

在vscode中使用npm安装软件包时,我收到如下的某些WARN消息。我应该为他们担心还是可以吗?

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})      
npm WARN backend@1.0.0 No description
npm WARN backend@1.0.0 No repository field.

1 个答案:

答案 0 :(得分:1)

使用npm安装任何软件包时,通常无需担心警告。您可以使用以下选项运行npm以仅查看错误:

--loglevel=error

在您的情况下: 对于fsevents显示警告,该事件仅在OSX上运行,而不能在Windows和Linux上安装。

警告显示类似这样的内容:

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

尽管您的应用程序和功能可能会按预期运行,但以上警告表示该软件包已弃用,而开发人员不再支持该软件包。

因此,在这种情况下,最好将特定的软件包更新为较新的版本,因为不建议使用的版本可能存在一些问题。例如,如果您对core-js拥有类似上面的警告,则可以使用以下命令安装最新的软件包:

npm install --save core-js@^3