为啥 npm list 在添加纱线后会显示缺失和无关的错误?
Posted
技术标签:
【中文标题】为啥 npm list 在添加纱线后会显示缺失和无关的错误?【英文标题】:Why does npm list show missing and extraneous errors after a yarn add?为什么 npm list 在添加纱线后会显示缺失和无关的错误? 【发布时间】:2017-05-30 16:40:00 【问题描述】:我正在一个项目中从 npm 切换到 yarn,刚开始通过 yarn add
添加一个模块。
但是后来我做了一个 npm 列表,现在它显示了大量的错误:无关的和丢失的错误。
我是否遗漏了什么——或者我现在应该忽略这些 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
【问题讨论】:
我也有类似的问题。还没有解决方案 【参考方案1】:如果你仍然有一个 package-lock.json
或 npm-shrinkwrap.json
坐在那里,npm ls 将缺少这方面的依赖。
要强制npm ls
只查看文件系统,你必须先运行它,然后你可以 npm ls
npm config set shrinkwrap false && npm config set package-lock false
【讨论】:
以上是关于为啥 npm list 在添加纱线后会显示缺失和无关的错误?的主要内容,如果未能解决你的问题,请参考以下文章