詳解linux下fsevents模塊引起的npm ls報(bào)錯(cuò)解決辦法
有個(gè)項(xiàng)目在mac下開(kāi)發(fā),安裝包npm i,一切正常;
把這個(gè)項(xiàng)目放到linux機(jī)器上,安裝包npm i,報(bào)了一堆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 fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN 0403@1.0.0 No description npm WARN 0403@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: abbrev@1.1.1 (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: ansi-regex@2.1.1 (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: aproba@1.2.0 (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: balanced-match@1.0.0 (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: chownr@1.1.1 (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: code-point-at@1.1.0 (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' ...
執(zhí)行npm ls,有不少UNMET OPTIONAL DEPENDENCY的模塊,最后還報(bào)了一堆錯(cuò):
│ ├── define-property@2.0.2 deduped │ ├── extend-shallow@3.0.2 deduped │ ├── regex-not@1.0.2 deduped │ └─┬ safe-regex@1.1.0 │ └── ret@0.1.15 ├─┬ UNMET OPTIONAL DEPENDENCY fsevents@1.2.7 │ ├── nan@2.13.2 │ └─┬ UNMET OPTIONAL DEPENDENCY node-pre-gyp@0.10.3 │ ├── UNMET OPTIONAL DEPENDENCY detect-libc@1.0.3 │ ├─┬ UNMET DEPENDENCY mkdirp@0.5.1 │ │ └── UNMET DEPENDENCY minimist@0.0.8 │ ├─┬ UNMET OPTIONAL DEPENDENCY needle@2.2.4 │ │ ├─┬ UNMET OPTIONAL DEPENDENCY debug@2.6.9 │ │ │ └── UNMET OPTIONAL DEPENDENCY ms@2.0.0 │ │ ├─┬ UNMET OPTIONAL DEPENDENCY iconv-lite@0.4.24 │ │ │ └── UNMET OPTIONAL DEPENDENCY safer-buffer@2.1.2 │ │ └── UNMET OPTIONAL DEPENDENCY sax@1.2.4 │ ├─┬ UNMET OPTIONAL DEPENDENCY nopt@4.0.1 │ │ ├── UNMET OPTIONAL DEPENDENCY abbrev@1.1.1 │ │ └─┬ UNMET OPTIONAL DEPENDENCY osenv@0.1.5 │ │ ├── UNMET OPTIONAL DEPENDENCY os-homedir@1.0.2 │ │ └── UNMET OPTIONAL DEPENDENCY os-tmpdir@1.0.2 │ ├─┬ UNMET OPTIONAL DEPENDENCY npm-packlist@1.2.0 │ │ ├─┬ UNMET OPTIONAL DEPENDENCY ignore-walk@3.0.1 │ │ │ └─┬ UNMET DEPENDENCY minimatch@3.0.4 │ │ │ └─┬ UNMET DEPENDENCY brace-expansion@1.1.11 │ │ │ ├── UNMET DEPENDENCY balanced-match@1.0.0 │ │ │ └── UNMET DEPENDENCY concat-map@0.0.1 │ │ └── UNMET OPTIONAL DEPENDENCY npm-bundled@1.0.5 │ ├─┬ UNMET OPTIONAL DEPENDENCY npmlog@4.1.2 │ │ ├─┬ UNMET OPTIONAL DEPENDENCY are-we-there-yet@1.1.5 │ │ │ ├── UNMET OPTIONAL DEPENDENCY delegates@1.0.0 │ │ │ └─┬ UNMET OPTIONAL DEPENDENCY readable-stream@2.3.6 │ │ │ ├── UNMET OPTIONAL DEPENDENCY core-util-is@1.0.2 │ │ │ ├── UNMET DEPENDENCY inherits@2.0.3 │ │ │ ├── UNMET OPTIONAL DEPENDENCY isarray@1.0.0 │ │ │ ├── UNMET OPTIONAL DEPENDENCY process-nextick-args@2.0.0 │ │ │ ├── UNMET DEPENDENCY safe-buffer@5.1.2 │ │ │ ├─┬ UNMET OPTIONAL DEPENDENCY string_decoder@1.1.1 │ │ │ │ └── UNMET DEPENDENCY safe-buffer@5.1.2 │ │ │ └── UNMET OPTIONAL DEPENDENCY util-deprecate@1.0.2 │ │ ├── UNMET DEPENDENCY console-control-strings@1.1.0 │ │ ├─┬ UNMET OPTIONAL DEPENDENCY gauge@2.7.4 │ │ │ ├── UNMET OPTIONAL DEPENDENCY aproba@1.2.0 │ │ │ ├── UNMET DEPENDENCY console-control-strings@1.1.0 │ │ │ ├── UNMET OPTIONAL DEPENDENCY has-unicode@2.0.1 │ │ │ ├── UNMET OPTIONAL DEPENDENCY object-assign@4.1.1 │ │ │ ├── UNMET OPTIONAL DEPENDENCY signal-exit@3.0.2 │ │ │ ├─┬ UNMET DEPENDENCY string-width@1.0.2 │ │ │ │ ├── UNMET DEPENDENCY code-point-at@1.1.0 │ │ │ │ ├─┬ UNMET DEPENDENCY is-fullwidth-code-point@1.0.0 │ │ │ │ │ └── UNMET DEPENDENCY number-is-nan@1.0.1 │ │ │ │ └── UNMET DEPENDENCY strip-ansi@3.0.1 │ │ │ ├─┬ UNMET DEPENDENCY strip-ansi@3.0.1 │ │ │ │ └── UNMET DEPENDENCY ansi-regex@2.1.1 │ │ │ └─┬ UNMET OPTIONAL DEPENDENCY wide-align@1.1.3 │ │ │ └── UNMET DEPENDENCY string-width@1.0.2 │ │ └── UNMET OPTIONAL DEPENDENCY set-blocking@2.0.0 │ ├─┬ UNMET OPTIONAL DEPENDENCY rc@1.2.8 │ │ ├── UNMET OPTIONAL DEPENDENCY deep-extend@0.6.0 │ │ ├── UNMET OPTIONAL DEPENDENCY ini@1.3.5 │ │ ├── UNMET OPTIONAL DEPENDENCY minimist@1.2.0 │ │ └── UNMET OPTIONAL DEPENDENCY strip-json-comments@2.0.1 │ ├─┬ UNMET OPTIONAL DEPENDENCY rimraf@2.6.3 │ │ └─┬ UNMET OPTIONAL DEPENDENCY glob@7.1.3 │ │ ├── UNMET OPTIONAL DEPENDENCY fs.realpath@1.0.0 │ │ ├─┬ UNMET OPTIONAL DEPENDENCY inflight@1.0.6 │ │ │ ├── UNMET DEPENDENCY once@1.4.0 │ │ │ └── UNMET DEPENDENCY wrappy@1.0.2 │ │ ├── UNMET DEPENDENCY inherits@2.0.3 │ │ ├── UNMET DEPENDENCY minimatch@3.0.4 │ │ ├─┬ UNMET DEPENDENCY once@1.4.0 │ │ │ └── UNMET DEPENDENCY wrappy@1.0.2 │ │ └── UNMET OPTIONAL DEPENDENCY path-is-absolute@1.0.1 │ ├── UNMET OPTIONAL DEPENDENCY semver@5.6.0 │ └─┬ UNMET OPTIONAL DEPENDENCY tar@4.4.8 │ ├── UNMET OPTIONAL DEPENDENCY chownr@1.1.1 │ ├─┬ UNMET OPTIONAL DEPENDENCY fs-minipass@1.2.5 │ │ └── UNMET DEPENDENCY minipass@2.3.5 │ ├─┬ UNMET DEPENDENCY minipass@2.3.5 │ │ ├── UNMET DEPENDENCY safe-buffer@5.1.2 │ │ └── UNMET DEPENDENCY yallist@3.0.3 │ ├─┬ UNMET OPTIONAL DEPENDENCY minizlib@1.2.1 │ │ └── UNMET DEPENDENCY minipass@2.3.5 │ ├── UNMET DEPENDENCY mkdirp@0.5.1 │ ├── UNMET DEPENDENCY safe-buffer@5.1.2 │ └── UNMET DEPENDENCY yallist@3.0.3 ├─┬ glob-parent@3.1.0 │ ├─┬ is-glob@3.1.0 │ │ └── is-extglob@2.1.1 deduped │ └── path-dirname@1.0.2 ├── inherits@2.0.3 ├─┬ is-binary-path@1.0.1 │ └── binary-extensions@1.13.1 ├─┬ is-glob@4.0.1 │ └── is-extglob@2.1.1 ├── normalize-path@3.0.0 ├── path-is-absolute@1.0.1 ├─┬ readdirp@2.2.1 │ ├── graceful-fs@4.1.15 │ ├── micromatch@3.1.10 deduped │ └─┬ readable-stream@2.3.6 │ ├── core-util-is@1.0.2 │ ├── inherits@2.0.3 deduped │ ├── isarray@1.0.0 │ ├── process-nextick-args@2.0.0 │ ├── safe-buffer@5.1.2 │ ├─┬ string_decoder@1.1.1 │ │ └── safe-buffer@5.1.2 deduped │ └── util-deprecate@1.0.2 └── upath@1.1.2
npm ERR! missing: mkdirp@0.5.1, required by node-pre-gyp@0.10.3 npm ERR! missing: minimist@0.0.8, required by mkdirp@0.5.1 npm ERR! missing: minimatch@3.0.4, required by ignore-walk@3.0.1 npm ERR! missing: brace-expansion@1.1.11, required by minimatch@3.0.4 npm ERR! missing: balanced-match@1.0.0, required by brace-expansion@1.1.11 npm ERR! missing: concat-map@0.0.1, required by brace-expansion@1.1.11 npm ERR! missing: console-control-strings@1.1.0, required by npmlog@4.1.2 npm ERR! missing: inherits@2.0.3, required by readable-stream@2.3.6 npm ERR! missing: safe-buffer@5.1.2, required by readable-stream@2.3.6 npm ERR! missing: safe-buffer@5.1.2, required by string_decoder@1.1.1 npm ERR! missing: console-control-strings@1.1.0, required by gauge@2.7.4 npm ERR! missing: string-width@1.0.2, required by gauge@2.7.4 npm ERR! missing: strip-ansi@3.0.1, required by gauge@2.7.4 npm ERR! missing: code-point-at@1.1.0, required by string-width@1.0.2 npm ERR! missing: is-fullwidth-code-point@1.0.0, required by string-width@1.0.2 npm ERR! missing: strip-ansi@3.0.1, required by string-width@1.0.2 npm ERR! missing: number-is-nan@1.0.1, required by is-fullwidth-code-point@1.0.0 npm ERR! missing: ansi-regex@2.1.1, required by strip-ansi@3.0.1 npm ERR! missing: string-width@1.0.2, required by wide-align@1.1.3 npm ERR! missing: inherits@2.0.3, required by glob@7.1.3 npm ERR! missing: minimatch@3.0.4, required by glob@7.1.3 npm ERR! missing: once@1.4.0, required by glob@7.1.3 npm ERR! missing: once@1.4.0, required by inflight@1.0.6 npm ERR! missing: wrappy@1.0.2, required by inflight@1.0.6 npm ERR! missing: wrappy@1.0.2, required by once@1.4.0 npm ERR! missing: minipass@2.3.5, required by tar@4.4.8 npm ERR! missing: mkdirp@0.5.1, required by tar@4.4.8 npm ERR! missing: safe-buffer@5.1.2, required by tar@4.4.8 npm ERR! missing: yallist@3.0.3, required by tar@4.4.8 npm ERR! missing: minipass@2.3.5, required by fs-minipass@1.2.5 npm ERR! missing: safe-buffer@5.1.2, required by minipass@2.3.5 npm ERR! missing: yallist@3.0.3, required by minipass@2.3.5 npm ERR! missing: minipass@2.3.5, required by minizlib@1.2.1
仔細(xì)觀察發(fā)現(xiàn)UNMET OPTIONAL DEPENDENCY的模塊和npm ERR是同一批模塊,也是安裝時(shí)報(bào)warning的那些模塊。
再仔細(xì)觀察發(fā)現(xiàn)這些都是fsevents依賴的模塊。
fsevents只能在macOS下安裝,無(wú)法在linux系統(tǒng)安裝。linux下會(huì)跳過(guò)fsevents模塊,也不會(huì)安裝fsevents依賴的模塊。
這其實(shí)算是npm的一個(gè)bug,npm i時(shí)報(bào)Warn,npm ls又報(bào)Err,前后不一致,容易有誤解。
目前無(wú)論用哪個(gè)版本的npm都會(huì)有這個(gè)問(wèn)題,npm i --no-optional也不能解決這個(gè)問(wèn)題。
這些報(bào)錯(cuò)不影響項(xiàng)目的正常運(yùn)行,因?yàn)閘inux不需要fsevents。
如果不希望看到npm Err,可以用npm i -f強(qiáng)制安裝,安裝過(guò)程沒(méi)有warn,安裝完后npm ls看下:
└─┬ chokidar@2.1.5 └── fsevents@1.2.7
干凈了,沒(méi)有任何報(bào)錯(cuò)。
我的項(xiàng)目是chokidar這個(gè)模塊依賴了fsevents,chokidar又是browser-sync、webpack等依賴的。
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- 在linux下玩轉(zhuǎn)帶有超時(shí)時(shí)間的connect函數(shù)
- linux下搭建go環(huán)境的安裝配置講解
- linux的cut命令用法總結(jié)
- 詳解linux系統(tǒng)輸入輸出管理和vim的常用功能
- linux shell之通過(guò)標(biāo)識(shí)測(cè)試文件系統(tǒng)屬性的方法示例
- linux shell中if的各種判斷
- linux shell之pushd、popd和dirs的使用講解
- linux shell之控制臺(tái)打印各種顏色字體和背景的實(shí)現(xiàn)方法
- linux下查看so或可執(zhí)行程序的依賴庫(kù)
- linux中alarm函數(shù)的實(shí)例講解
相關(guān)文章
CentOS服務(wù)器iptables配置簡(jiǎn)單教程
這篇文章主要為大家詳細(xì)介紹了CentOS服務(wù)器iptables配置簡(jiǎn)單教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-10-10Apache中解決動(dòng)態(tài)地址跳轉(zhuǎn)死循環(huán)的方法
這篇文章主要介紹了Apache中解決動(dòng)態(tài)地址跳轉(zhuǎn)死循環(huán)的方法,另外作者還提出了盡量使用偽靜態(tài)的建議,需要的朋友可以參考下2015-07-07淺談三種配置linux環(huán)境變量的方法(以java為例)
下面小編就為大家?guī)?lái)一篇淺談三種配置linux環(huán)境變量的方法(以java為例)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-12-12Ubuntu服務(wù)器下搭建php運(yùn)行環(huán)境的方法
這篇文章主要介紹了Ubuntu服務(wù)器下搭建php運(yùn)行環(huán)境的方法,簡(jiǎn)單分析了Ubuntu操作系統(tǒng)環(huán)境下搭建Apache、php及mysql模塊相關(guān)步驟、命令與操作技巧,需要的朋友可以參考下2018-04-04Linux環(huán)境下快速搭建ftp服務(wù)器方法介紹
這篇文章主要介紹了Linux環(huán)境下快速搭建ftp服務(wù)器方法介紹,分享了相關(guān)代碼示例,小編覺(jué)得還是挺不錯(cuò)的,具有一定借鑒價(jià)值,需要的朋友可以參考下2018-01-01Linux內(nèi)核設(shè)備驅(qū)動(dòng)之虛擬文件系統(tǒng)筆記整理
今天小編就為大家分享一篇關(guān)于Linux內(nèi)核設(shè)備驅(qū)動(dòng)之虛擬文件系統(tǒng)筆記整理,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2018-12-12記一次Centos服務(wù)器被掛馬的抓馬經(jīng)歷
這篇文章主要介紹了記一次Centos服務(wù)器被掛馬的抓馬經(jīng)歷分享,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下2017-01-01Ubuntu 20.04 CUDA&cuDNN安裝方法(圖文教程)
這篇文章主要介紹了Ubuntu 20.04 CUDA&cuDNN安裝方法(圖文教程),文中通過(guò)圖文代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-07-07詳解CentOS 6.5如何安裝Realtek無(wú)線網(wǎng)卡驅(qū)動(dòng)
相信大家都應(yīng)該知道CentOS6.5不像CentOS7和Unbuntu那樣自動(dòng)安裝好了無(wú)線網(wǎng)卡驅(qū)動(dòng),如果想要在CentOS 6.5上實(shí)現(xiàn)無(wú)線上網(wǎng),我們就需要折騰一下,這篇文章給大家介紹了詳細(xì)的步驟,感興趣的朋友們下面來(lái)一起看看吧。2016-10-10