Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents

People also ask

Why npm SKIPPING optional DEPENDENCY?

It's a warning, not an error. It occurs because fsevents is an optional dependency, used only when project is run on macOS environment (the package provides 'Native Access to Mac OS-X FSEvents'). And since you're running your project on Windows, fsevents is skipped as irrelevant.

How install optional dependencies NPM?

Execute npm install someDependency --save-optional to install a package as an optional dependency. The installed package will be put into optionalDependencies . When you want to avoid installing optional dependencies, you can execute npm ci --no-optional (e.g. on CI tools like GitLab CI).


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

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

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


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.json which gets persisted after every package manager execution. Subsequent attempts keep failing as this file is referenced instead of package.json.

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

   --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!


Using parameter --force:

npm i -f

Unsupported platform for fsevents

The current best solution is upgrading your version of npm, which won't have this warning.

If using a Windows machine, an easy way to upgrade is with the tool Upgrade npm on Windows.