Following warning is being thrown on npm install
command -
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\\rea
ct-
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
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
Use sudo npm install -g appium
.
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!
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
Switch to PNPM: https://pnpm.js.org/
The fsevents
warnings are gone (on Linux).
Even the latest yarn (2.x) shows the warnings.