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

Analysis of Linux Zabbix custom monitoring and alarm implementation process

Target Display one of the data in the iostat comm...

How to install setup.py program in linux

First execute the command: [root@mini61 setuptool...

Perform data statistics on different values ​​of the same field in SQL

Application scenario: It is necessary to count th...

Classes in TypeScript

Table of contents 1. Overview 2. Define a simple ...

Two simple menu navigation bar examples

Menu bar example 1: Copy code The code is as foll...

How to create your own Docker image and upload it to Dockerhub

1. First register your own dockerhub account, reg...

Detailed explanation of the new features of ES9: Async iteration

Table of contents Asynchronous traversal Asynchro...

Detailed analysis of the principles and usage of MySQL views

Preface: In MySQL, views are probably one of the ...

Solutions to the Problem of Creating XHTML and CSS Web Pages

The solutions to the problems encountered during x...

How to use positioning to center elements (web page layout tips)

How to center an element in the browser window He...

Detailed tutorial on deploying SpringBoot + Vue project to Linux server

Preface Let me share with you how I deployed a Sp...

JavaScript custom calendar effect

This article shares the specific code of JavaScri...