linux下fsevents模块引起的npm ls报错解决办法
- 有个项目在mac下开发,安装包
npm i
,一切正常; 把这个项目放到linux机器上,安装包
npm i
,报了一堆warning: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' ...
执行
npm ls
,有不少UNMET OPTIONAL DEPENDENCY
的模块,最后还报了一堆错:│ ├── [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]
仔细观察发现
UNMET OPTIONAL DEPENDENCY
的模块和npm ERR
是同一批模块,也是安装时报warning的那些模块。再仔细观察发现这些都是
fsevents
依赖的模块。fsevents
只能在macOS下安装,无法在linux系统安装。linux下会跳过fsevents
模块,也不会安装fsevents
依赖的模块。这其实算是npm的一个bug,
npm i
时报Warn
,npm ls
又报Err
,前后不一致,容易有误解。目前无论用哪个版本的npm都会有这个问题,
npm i --no-optional
也不能解决这个问题。这些报错不影响项目的正常运行,因为linux不需要
fsevents
。如果不希望看到
npm ERR
,可以用npm i -f
强制安装,安装过程没有warn,安装完后npm ls
看下:└─┬ [email protected] └── [email protected]
干净了,没有任何报错。
我的项目是
chokidar
这个模块依赖了fsevents
,chokidar
又是browser-sync
、webpack
等依赖的。
相关推荐
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20