我正在创建一个NPM软件包。用户安装我的NPM软件包时如何安装“ peerDependency”?

时间:2020-02-01 07:17:26

标签: javascript react-native npm npm-publish

我遇到react-native-vector-icons的问题。我将其安装为dependencypeerDependency,但是当我将NPM软件包安装到项目中时,出现错误。据我了解,peerDependency是用于npm软件包的依赖项,因此已安装了我的NPM库的软件包。正确吗?

在我的NPM库中,我已在自己的podfile和info.plist中手动链接了react-native-vector-icons

podfile

pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

info.plist

<key>UIAppFonts</key>
<array>
  <string>AntDesign.ttf</string>
  <string>Entypo.ttf</string>
  <string>EvilIcons.ttf</string>
  <string>Feather.ttf</string>
  <string>FontAwesome.ttf</string>
  <string>FontAwesome5_Brands.ttf</string>
  <string>FontAwesome5_Regular.ttf</string>
  <string>FontAwesome5_Solid.ttf</string>
  <string>Foundation.ttf</string>
  <string>Ionicons.ttf</string>
  <string>MaterialIcons.ttf</string>
  <string>MaterialCommunityIcons.ttf</string>
  <string>SimpleLineIcons.ttf</string>
  <string>Octicons.ttf</string>
  <string>Zocial.ttf</string>
</array>

package.json

 "dependencies": {
    "react-native-iphone-x-helper": "^1.2.1",
    "react-native-modal": "^11.5.3",
    "react-native-vector-icons": "^6.6.0"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "@types/jest": "^24.0.24",
    "@types/react-native": "^0.60.25",
    "@types/react-native-vector-icons": "^6.4.5",
    "@types/react-test-renderer": "16.9.1",
    "@typescript-eslint/eslint-plugin": "^2.12.0",
    "@typescript-eslint/parser": "^2.12.0",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-test-renderer": "16.9.0",
    "typescript": "^3.7.3"
  },
  "peerDependencies": {
    "react": "*",
    "react-native": "*",
    "react-native-iphone-x-helper": "^1.2.1",
    "react-native-modal": "^11.5.3",
    "react-native-vector-icons": "^6.6.0"
  },

0 个答案:

没有答案