7

我正在一个项目中从 npm 切换到 yarn,并且刚开始通过添加一个模块yarn add

但是后来我做了一个 npm list ,现在它显示了大量的错误:无关的和丢失的错误。

我是否遗漏了什么——或者我现在应该忽略这些 npm 错误。我可以对 yarn 使用什么命令来确保我的依赖项没有错误/缺失?

 npm ERR! peer dep missing: react-dom@0.14.x || 15.* || ^15.0.0, required by react-apollo@0.8.1
    npm ERR! invalid: react-native@0.37.0 /Users/user/Projects/foo-app/node_modules/react-native
    npm ERR! extraneous: absolute-path@0.0.0 /Users/user/Projects/foo-app/node_modules/absolute-path
    npm ERR! extraneous: art@0.10.1 /Users/user/Projects/foo-app/node_modules/art
    npm ERR! extraneous: babel-plugin-external-helpers@6.18.0 /Users/user/Projects/foo-app/node_modules/babel-plugin-external-helpers
    npm ERR! extraneous: babel-polyfill@6.20.0 /Users/user/Projects/foo-app/node_modules/babel-polyfill
    npm ERR! extraneous: babel-preset-es2015-node@6.1.1 /Users/user/Projects/foo-app/node_modules/babel-preset-es2015-node
    npm ERR! extraneous: babel-preset-fbjs@2.1.0 /Users/user/Projects/foo-app/node_modules/babel-preset-fbjs
    npm ERR! extraneous: connect@2.30.2 /Users/user/Projects/foo-app/node_modules/connect
    npm ERR! extraneous: denodeify@1.2.1 /Users/user/Projects/foo-app/node_modules/denodeify
    npm ERR! extraneous: event-target-shim@1.1.1 /Users/user/Projects/foo-app/node_modules/event-target-shim
    npm ERR! extraneous: fbjs-scripts@0.7.1 /Users/user/Projects/foo-app/node_modules/fbjs-scripts
    npm ERR! extraneous: fs-extra@0.26.7 /Users/user/Projects/foo-app/node_modules/fs-extra
    npm ERR! extraneous: image-size@0.3.5 /Users/user/Projects/foo-app/node_modules/image-size
    npm ERR! extraneous: immutable@3.7.6 /Users/user/Projects/foo-app/node_modules/immutable
    npm ERR! extraneous: inquirer@0.12.0 /Users/user/Projects/foo-app/node_modules/inquirer
    npm ERR! extraneous: jest-haste-map@15.0.1 /Users/user/Projects/foo-app/node_modules/jest-haste-map
    npm ERR! extraneous: joi@6.10.1 /Users/user/Projects/foo-app/node_modules/joi
    npm ERR! extraneous: json5@0.4.0 /Users/user/Projects/foo-app/node_modules/json5
    npm ERR! extraneous: jstransform@11.0.3 /Users/user/Projects/foo-app/node_modules/jstransform
    npm ERR! extraneous: lodash@3.10.1 /Users/user/Projects/foo-app/node_modules/lodash
    npm ERR! extraneous: mime@1.3.4 /Users/user/Projects/foo-app/node_modules/mime
    npm ERR! extraneous: module-deps@3.9.1 /Users/user/Projects/foo-app/node_modules/module-deps
    npm ERR! extraneous: npmlog@2.0.4 /Users/user/Projects/foo-app/node_modules/npmlog
    npm ERR! extraneous: opn@3.0.3 /Users/user/Projects/foo-app/node_modules/opn
    npm ERR! extraneous: plist@1.2.0 /Users/user/Projects/foo-app/node_modules/plist
    npm ERR! extraneous: progress@1.1.8 /Users/user/Projects/foo-app/node_modules/progress
    npm ERR! extraneous: rebound@0.0.13 /Users/user/Projects/foo-app/node_modules/rebound
    npm ERR! extraneous: regenerator-runtime@0.9.6 /Users/user/Projects/foo-app/node_modules/regenerator-runtime
    npm ERR! extraneous: stacktrace-parser@0.1.4 /Users/user/Projects/foo-app/node_modules/stacktrace-parser
    npm ERR! extraneous: temp@0.8.3 /Users/user/Projects/foo-app/node_modules/temp
    npm ERR! extraneous: whatwg-fetch@1.1.1 /Users/user/Projects/foo-app/node_modules/whatwg-fetch
    npm ERR! extraneous: ws@1.1.1 /Users/user/Projects/foo-app/node_modules/ws
    npm ERR! extraneous: xcode@0.8.9 /Users/user/Projects/foo-app/node_modules/xcode
    npm ERR! extraneous: xmldoc@0.4.0 /Users/user/Projects/foo-app/node_modules/xmldoc
    npm ERR! extraneous: yargs@3.32.0 /Users/user/Projects/foo-app/node_modules/yargs
    npm ERR! extraneous: yeoman-environment@1.5.3 /Users/user/Projects/foo-app/node_modules/yeoman-environment
    npm ERR! extraneous: yeoman-generator@0.21.2 /Users/user/Projects/foo-app/node_modules/yeoman-generator
    npm ERR! extraneous: react-native-lightbox@0.6.0 /Users/user/Projects/foo-app/node_modules/react-native-lightbox
    npm ERR! extraneous: react-native-maps@0.11.0 /Users/user/Projects/foo-app/node_modules/react-native-maps
    npm ERR! extraneous: react-native-svg@4.3.0 /Users/user/Projects/foo-app/node_modules/react-native-svg
    npm ERR! extraneous: react-native-transformable-image@0.0.18 /Users/user/Projects/foo-app/node_modules/react-native-transformable-image
    npm ERR! extraneous: react-native-view-transformer@0.0.28 /Users/user/Projects/foo-app/node_modules/react-native-view-transformer
    npm ERR! missing: react-native-lightbox@git+https://github.com/shoutem/react-native-lightbox.git#master, required by @shoutem/ui@0.10.5
    npm ERR! missing: react-native-transformable-image@github:ldn0x7dc/react-native-transformable-image#master, required by @shoutem/ui@0.10.5
    npm ERR! missing: react-native-view-transformer@github:ldn0x7dc/react-native-view-transformer#master, required by @shoutem/ui@0.10.5
    npm ERR! missing: react-native-maps@git+https://github.com/exponent/react-native-maps.git#12853f0, required by exponent@12.0.5
    npm ERR! missing: react-native-svg@git+https://github.com/exponent/react-native-svg.git#51ff90cc, required by exponent@12.0.5
    npm ERR! missing: jest-resolve@git+https://github.com/exponentjs/jest-resolve.git, required by jest-exponent@0.1.4
4

1 回答 1

0

如果您仍然有一个package-lock.json或一个人npm-shrinkwrap.json坐在旁边,npm ls 将缺少相关的依赖。

要强制npm ls只查看文件系统,您必须先运行它,然后您可以 npm ls

npm config set shrinkwrap false && npm config set package-lock false
于 2020-05-14T22:29:06.563 回答