node.js npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: [email protected] 不受支持的平台

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40226745/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 17:47:51  来源:igfitidea点击:

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]

node.jsnpmminimatch

提问by Aishwary Tiwari

I`m trying to run this project https://github.com/Soundnode/soundnode-appafter updating my minimatch version to 3.10.9, im getting this error

我正在尝试 在将 minimatch 版本更新到 3.10.9 后运行这个项目https://github.com/Soundnode/soundnode-app,我收到这个错误

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\webpack\node_modules\watchpack\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})

npm WARN 可选跳过可选依赖项:fsevents@^1.0.0 (node_modules\webpack\node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):npm WARN notsup 跳过可选依赖项:{1.14@ 不支持的平台 fsevents: os":"darwin","arch":"any"}(当前:{"os":"win32","arch":"ia32"})

my configuration is Node v - 4.4.2 npm v- 3.10.9 im working on 32 bit windows OS

我的配置是 Node v - 4.4.2 npm v- 3.10.9 im 在 32 位 Windows 操作系统上工作

回答by piotr.d

It's a warning, not an error. It occurs because fseventsis an optional dependency, used only when project is run on macOS environment (the package provides 'Native Access to Mac OS-X FSEvents').

这是警告,而不是错误。这是因为它fsevents是一个可选的依赖项,仅在项目在 macOS 环境中运行时使用(该包提供“对 Mac OS-X FSEvents 的本机访问”)。

And since you're running your project on Windows, fseventsis skipped as irrelevant.

并且由于您在 Windows 上运行您的项目,因此fsevents被忽略为无关紧要。

There is a PR to fix this behaviour here: https://github.com/npm/cli/pull/169

这里有一个 PR 来解决这个问题:https: //github.com/npm/cli/pull/169

回答by nickl-

This still appears to be an issue, causing package installations to be aborted with warnings about optional packages no being installed because of "Unsupported platform".

这似乎仍然是一个问题,导致软件包安装中止,并显示有关由于“不受支持的平台”而未安装可选软件包的警告。

The problem relates to the "shrinkwrap" or package-lock.jsonwhich gets persisted after every package manager execution. Subsequent attempts keep failing as this file is referenced instead of package.json.

问题与“收缩包装”有关,或者package-lock.json在每次包管理器执行后都会持续存在。由于引用了此文件而不是package.json.

Adding these options to the npm installcommand should allow packages to install again.

将这些选项添加到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.

The complete command looks like this:

完整的命令如下所示:

    npm install --no-optional --no-shrinkwrap --no-package-lock

nJoy!

快乐!

回答by JFs

Using parameter --force:

使用参数 --force:

npm i -f