列出npm本地模块会产生错误

时间:2018-11-28 07:23:17

标签: npm

我正在使用npx create-react-app my-react创建新的reactjs应用程序。 一切正常,但是当使用my-reactnpm ls --depth=0文件夹中列出本地模块时,npm会丢失一些错误:

    my-react@0.1.0 /tmp/my-react
    ├── react@16.6.3
    ├── react-dom@16.6.3
    └── react-scripts@2.1.1

    npm ERR! missing: mkdirp@0.5.1, required by node-pre-gyp@0.10.0
    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.1, required by readable-stream@2.3.6
    npm ERR! missing: safe-buffer@5.1.1, 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.2
    npm ERR! missing: inherits@2.0.3, required by glob@7.1.2
    npm ERR! missing: minimatch@3.0.4, required by glob@7.1.2
    npm ERR! missing: once@1.4.0, required by glob@7.1.2
    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.2.4, required by tar@4.4.1
    npm ERR! missing: mkdirp@0.5.1, required by tar@4.4.1
    npm ERR! missing: safe-buffer@5.1.1, required by tar@4.4.1
    npm ERR! missing: yallist@3.0.2, required by tar@4.4.1
    npm ERR! missing: minipass@2.2.4, required by fs-minipass@1.2.5
    npm ERR! missing: safe-buffer@5.1.1, required by minipass@2.2.4
    npm ERR! missing: yallist@3.0.2, required by minipass@2.2.4
    npm ERR! missing: minipass@2.2.4, required by minizlib@1.1.0

1 个答案:

答案 0 :(得分:0)

我也碰到了这一点,做了一些查找。当前npm处理可选依赖项的方式似乎有问题。如果您执行完整的npm list,您会发现罪魁祸首是fsevents

UNMET OPTIONAL DEPENDENCY fsevents@1.2.4
│ ├── UNMET OPTIONAL DEPENDENCY nan@2.12.1
│ └─┬ UNMET OPTIONAL DEPENDENCY node-pre-gyp@0.10.0
│   ├── 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.0
│   │ ├─┬ UNMET OPTIONAL DEPENDENCY debug@2.6.9
│   │ │ └── UNMET OPTIONAL DEPENDENCY ms@2.0.0
│   │ ├─┬ UNMET OPTIONAL DEPENDENCY iconv-lite@0.4.21
│   │ │ └── 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.1.10
│   │ ├─┬ 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.3
│   ├─┬ UNMET OPTIONAL DEPENDENCY npmlog@4.1.2
│   │ ├─┬ UNMET OPTIONAL DEPENDENCY are-we-there-yet@1.1.4
│   │ │ ├── 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.1
│   │ │   ├─┬ UNMET OPTIONAL DEPENDENCY string_decoder@1.1.1
│   │ │   │ └── UNMET DEPENDENCY safe-buffer@5.1.1
│   │ │   └── 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.2
│   │ │   └── UNMET DEPENDENCY string-width@1.0.2
│   │ └── UNMET OPTIONAL DEPENDENCY set-blocking@2.0.0
│   ├─┬ UNMET OPTIONAL DEPENDENCY rc@1.2.7
│   │ ├── UNMET OPTIONAL DEPENDENCY deep-extend@0.5.1
│   │ ├── 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.2
│   │ └─┬ UNMET OPTIONAL DEPENDENCY glob@7.1.2
│   │   ├── 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.5.0
│   └─┬ UNMET OPTIONAL DEPENDENCY tar@4.4.1
│     ├── UNMET OPTIONAL DEPENDENCY chownr@1.0.1
│     ├─┬ UNMET OPTIONAL DEPENDENCY fs-minipass@1.2.5
│     │ └── UNMET DEPENDENCY minipass@2.2.4
│     ├─┬ UNMET DEPENDENCY minipass@2.2.4
│     │ ├── UNMET DEPENDENCY safe-buffer@5.1.1
│     │ └── UNMET DEPENDENCY yallist@3.0.2
│     ├─┬ UNMET OPTIONAL DEPENDENCY minizlib@1.1.0
│     │ └── UNMET DEPENDENCY minipass@2.2.4
│     ├── UNMET DEPENDENCY mkdirp@0.5.1
│     ├── UNMET DEPENDENCY safe-buffer@5.1.1
│     └── UNMET DEPENDENCY yallist@3.0.2

fseventshttps://www.npmjs.com/package/fsevents)指出仅OS X操作系统需要它,因此,例如,如果您在Linux上,npm不会安装它,但还会报告作为错误(?)。行为令人困惑。但是它应该保留在package.json中,因为如果有人在Mac上安装您的代码,则需要fsevents

There was a PR for this针对npm存储库以将平台依赖项日志降至info,但是当开发人员将npm切换到新的回购协议时,它似乎已被放弃:\

目前,您可以放心地忽略它(并希望使构建系统也忽略它),或切换到yarn