Detailed explanation of the solution to npm ls errors caused by fsevents module under Linux

Detailed explanation of the solution to npm ls errors caused by fsevents module under Linux

There is a project developed on Mac, and the package npm i is installed, and everything is normal;

Put this project on a Linux machine, install the package npm i, and report a bunch of warnings:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents/node_modules/abbrev):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/root/2019/0403/node_modules/fsevents/node_modules/abbrev' -> '/root/2019/0403/node_modules/fsevents/node_modules/.abbrev.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents/node_modules/ansi-regex):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/root/2019/0403/node_modules/fsevents/node_modules/ansi-regex' -> '/root/2019/0403/node_modules/fsevents/node_modules/.ansi-regex.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents/node_modules/aproba):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/root/2019/0403/node_modules/fsevents/node_modules/aproba' -> '/root/2019/0403/node_modules/fsevents/node_modules/.aproba.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents/node_modules/balanced-match):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/root/2019/0403/node_modules/fsevents/node_modules/balanced-match' -> '/root/2019/0403/node_modules/fsevents/node_modules/.balanced-match.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents/node_modules/chownr):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/root/2019/0403/node_modules/fsevents/node_modules/chownr' -> '/root/2019/0403/node_modules/fsevents/node_modules/.chownr.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents/node_modules/code-point-at):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/root/2019/0403/node_modules/fsevents/node_modules/code-point-at' -> '/root/2019/0403/node_modules/fsevents/node_modules/.code-point-at.DELETE'
...

When executing npm ls, there are many UNMET OPTIONAL DEPENDENCY modules, and a lot of errors are reported at the end:

│ ├── [email protected] deduped
│ ├── [email protected] deduped
│ ├── [email protected] deduped
│ └─┬ [email protected]
│ └── [email protected]
├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ ├── [email protected]
│ └─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ ├─┬ UNMET DEPENDENCY [email protected]
│ │ └── UNMET DEPENDENCY [email protected]
│ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ └─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ └─┬ UNMET DEPENDENCY [email protected]
│ │ │ └─┬ UNMET DEPENDENCY [email protected]
│ │ │ ├── UNMET DEPENDENCY [email protected]
│ │ │ └── UNMET DEPENDENCY [email protected]
│ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ └─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET DEPENDENCY [email protected]
│ │ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET DEPENDENCY [email protected]
│ │ │ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ │ └── UNMET DEPENDENCY [email protected]
│ │ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├── UNMET DEPENDENCY [email protected]
│ │ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET DEPENDENCY [email protected]
│ │ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├─┬ UNMET DEPENDENCY [email protected]
│ │ │ │ ├── UNMET DEPENDENCY [email protected]
│ │ │ │ ├─┬ UNMET DEPENDENCY [email protected]
│ │ │ │ │ └── UNMET DEPENDENCY [email protected]
│ │ │ │ └── UNMET DEPENDENCY [email protected]
│ │ │ ├─┬ UNMET DEPENDENCY [email protected]
│ │ │ │ └── UNMET DEPENDENCY [email protected]
│ │ │ └─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ └── UNMET DEPENDENCY [email protected]
│ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ └─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ │ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ │ ├── UNMET DEPENDENCY [email protected]
│ │ │ └── UNMET DEPENDENCY [email protected]
│ │ ├── UNMET DEPENDENCY [email protected]
│ │ ├── UNMET DEPENDENCY [email protected]
│ │ ├─┬ UNMET DEPENDENCY [email protected]
│ │ │ └── UNMET DEPENDENCY [email protected]
│ │ └── UNMET OPTIONAL DEPENDENCY [email protected]
│ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ └─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ ├── UNMET OPTIONAL DEPENDENCY [email protected]
│ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ └── UNMET DEPENDENCY [email protected]
│ ├─┬ UNMET DEPENDENCY [email protected]
│ │ ├── UNMET DEPENDENCY [email protected]
│ │ └── UNMET DEPENDENCY [email protected]
│ ├─┬ UNMET OPTIONAL DEPENDENCY [email protected]
│ │ └── UNMET DEPENDENCY [email protected]
│ ├── UNMET DEPENDENCY [email protected]
│ ├── UNMET DEPENDENCY [email protected]
│ └── UNMET DEPENDENCY [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected] deduped
│ └─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected] deduped
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected]
└── [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: [email protected], required by [email protected]

A careful observation revealed that the UNMET OPTIONAL DEPENDENCY modules and npm ERR are the same modules, and are also the ones that report warnings during installation.

A closer look reveals that these are all modules that fsevents depends on.

fsevents can only be installed under macOS and cannot be installed on Linux systems. The fsevents module will be skipped under Linux, and the modules that fsevents depends on will not be installed.

This is actually a bug in npm. npm i reports a Warn, and npm ls reports an Err, which is inconsistent and easy to cause misunderstanding.

Currently, this problem will occur no matter which version of npm is used, and npm i --no-optional cannot solve this problem.

These errors do not affect the normal operation of the project because Linux does not require fsevents.

If you do not want to see npm Err, you can use npm i -f to force the installation. There will be no warning during the installation. After the installation, run npm ls to see:

Clean, no errors.

My project is chokidar, a module that depends on fsevents, and chokidar depends on browser-sync, webpack, etc.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Play with the connect function with timeout in Linux
  • Explanation of installation and configuration of building go environment under linux
  • Summary of Linux cut command usage
  • Detailed explanation of Linux system input and output management and common functions of vim
  • Linux shell - Example of how to test file system attributes by identification
  • Various judgments of if in linux shell
  • Linux shell pushd, popd and dirs usage explanation
  • How to print various color fonts and backgrounds in the Linux shell console
  • View the dependent libraries of so or executable programs under linux
  • Example explanation of alarm function in Linux

<<:  Master-slave synchronous replication configuration of MySQL database under Linux

>>:  Parent-child component communication in Vue and using sync to synchronize parent-child component data

Recommend

MySQL SQL statement performance tuning simple example

MySQL SQL statement performance tuning simple exa...

Using Docker Enterprise Edition to build your own private registry server

Docker is really cool, especially because it'...

Summary of common Nginx techniques and examples

1. Priority of multiple servers For example, if e...

Methods and steps for deploying go projects based on Docker images

Dependence on knowledge Go cross-compilation basi...

Why the explain command may modify MySQL data

If someone asked you whether running EXPLAIN on a...

MySQL 8.0.22 installation and configuration graphic tutorial

MySQL8.0.22 installation and configuration (super...

Vue3 implements Message component example

Table of contents Component Design Defining the f...

Summary of Docker Consul container service updates and issues found

Table of contents 1. Container service update and...

How to set up the terminal to run applications after Ubuntu starts

1. Enter start in the menu bar and click startup ...

MySQL index failure principle

Table of contents 1. Reasons for index failure 2....

How to prevent computer slowdown when WIN10 has multiple databases installed

Enable the service when you need it, and disable ...

Specific usage instructions for mysql-joins

Table of contents Join syntax: 1. InnerJOIN: (Inn...