如何解决:“错误fsevents@2.0.7:平台“ linux”与此模块不兼容。”

时间:2019-07-17 18:33:52

标签: node.js heroku npm yarnpkg mern

我想将我的网站部署到Heroku,但出现下一个错误:

error fsevents@2.0.7: The platform "linux" is incompatible with this module.
error Found incompatible module.

我已经尝试升级纱线,节点,但没有帮助。我使用的是macOS Mojave v 10.14.5,我不明白为什么Linux在这里。



remote: -----> Installing binaries
remote:        engines.node (package.json):  10.15.3
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  unspecified (use default)
remote:        
remote:        Resolving node version 10.15.3...
remote:        Downloading and installing node 10.15.3...
remote:        Using default npm version: 6.4.1
remote:        Resolving yarn version 1.x...
remote:        Downloading and installing yarn (1.17.3)...
remote:        Installed yarn 1.17.3
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v1.17.3
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
error fsevents@2.0.7: The platform "linux" is incompatible with this module.
remote:        error Found incompatible module.

2 个答案:

答案 0 :(得分:1)

我现在收到错误消息,但 Heroku 排除了 fsevents 并导致部署成功。

info fsevents@2.1.3: The platform "linux" is incompatible with this module.
remote:        info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        info fsevents@1.2.13: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.

https://my-app.herokuapp.com/ deployed to Heroku

我没有修改 yarn.lock 或任何其他文件。我结束了这篇文章,因为我对这个错误很好奇,现在我知道它只适用于 macOS。换句话说,忽略错误并留下 yarn.lock

答案 1 :(得分:0)

我删除了行

fsevents@^1.2.7, fsevents@^2.0.6:
  version "2.0.7"
  resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a"
  integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ==

  optionalDependencies:
    fsevents "^2.0.6"

来自yarn.lock。接下来我删除了

    "fsevents": "2.0.7",

通过resolutions中的package.json

最后我可以看到yarn install

info fsevents@2.0.7: The platform "linux" is incompatible with this module.
info "fsevents@2.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.

success Saved lockfile.

您不需要此模块,因为这仅适用于MacOS

  

对Node.js中的MacOS FSEvent的本地访问

https://www.npmjs.com/package/fsevents