How to solve npm install throwing fsevents warning on non-MAC OS?

前端 未结 15 1731
眼角桃花
眼角桃花 2020-11-28 04:07

Following warning is being thrown on npm install command -

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\\rea
ct-         


        
相关标签:
15条回答
  • 2020-11-28 04:29

    Instead of using --no-optional every single time, we can just add it to npm or yarn config.

    For Yarn, there is a default no-optional config, so we can just edit that:

    yarn config set ignore-optional true
    

    For npm, there is no default config set, so we can create one:

    npm config set ignore-optional true
    
    0 讨论(0)
  • 2020-11-28 04:33

    I found the same problem and i tried all the solution mentioned above and in github. Some works only in local repository, when i push my PR in remote repositories with travic-CI or Pipelines give me the same error back. Finally i fixed it by using the npm command below.

    npm audit fix --force

    0 讨论(0)
  • 2020-11-28 04:35

    Use sudo npm install -g appium.

    0 讨论(0)
  • 2020-11-28 04:36

    package.json counts with a optionalDependencies key. NPM on Optional Dependencies.

    You can add fsevents to this object and if you find yourself installing packages in a different platform than MacOS, fsevents will be skipped by either yarn or npm.

    "optionalDependencies": {
      "fsevents": "2.1.2"
    },
    

    You will find a message like the following in the installation log:

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

    Hope it helps!

    0 讨论(0)
  • 2020-11-28 04:37

    fsevents is dealt differently in mac and other linux system. Linux system ignores fsevents whereas mac install it. As the above error message states that fsevents is optional and it is skipped in installation process.

    You can run npm install --no-optional command in linux system to avoid above warning.

    Further information

    https://github.com/npm/npm/issues/14185

    https://github.com/npm/npm/issues/5095

    0 讨论(0)
  • 2020-11-28 04:38

    Switch to PNPM: https://pnpm.js.org/

    The fsevents warnings are gone (on Linux).

    Even the latest yarn (2.x) shows the warnings.

    0 讨论(0)
提交回复
热议问题