i created component react-native push npm package. although i'm facing issue.
the component dependent of npm package called react-native-image-resizer
. package needs linked rnpm
in order work.
although, when install component in brand new project, dependency won't linked automatically, , native library won't appear in project. of course, when run rnpm link
, won't add project either.
so i'm wondering best way install , link dependency?
macbook-pro:example $ npm install react-native-image-crop > react-native-image-crop@1.0.0 preinstall /users/alexmngn/work/react-native-image-crop/example/node_modules/.staging/react-native-image-crop-95365d1b > npm install --save react-native-image-resizer react-native-image-crop@1.0.0 (git+ssh://git@github.com/alexmngn/react-native-image-crop.git#90e002c7d0f01c9d61277c30cad375560f09a94a) /users/alexmngn/work/react-native-image-crop/example/node_modules/.staging/react-native-image-crop-95365d1b ├── unmet dependency react-native@^0.31.0 └── react-native-image-resizer@0.0.9 npm warn react-native-image-resizer@0.0.9 requires peer of react-native@>=v0.14.2 none installed. npm warn react-native-image-crop@1.0.0 no repository field. - react-native-image-resizer@0.0.9 node_modules/react-native-image-crop/node_modules/react-native-image-resizer example@0.0.1 /users/alexmngn/work/react-native-image-crop/example └── react-native-image-crop@1.0.0 (git+ssh://git@github.com/alexmngn/react-native-image-crop.git#90e002c7d0f01c9d61277c30cad375560f09a94a) macbook-pro:example $ rnpm link macbook-pro:example $ # nothing gets linked here...
also, can see there, have unmet peer dependencies issue react-native when install component in example project, though listed (with right version) in dependencies in package.json:
{ "name": "example", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { "react": "15.2.1", "react-native": "^0.31.0", "react-native-image-crop": "git+ssh://github.com/alexmngn/react-native-image-crop.git" } }
any idea why complains?
repo of component available here: http://github.com/alexmngn/react-native-image-crop.git
thanks
the rnpm link
links packages found in package.json
, these packages installed via command rnpm install
or npm install --save
.
in order automatically install package, can write preinstall
npm script executed before package installed.
in thepackage.json
add scripts
block this
{ "scripts": { "preinstall": "npm install --save react-native-image-resizer@0.0.9" } }
after doing this, when try install pacakge via npm, react-native-image-resizer
installed first, , add leave ab entry package.json -> dependency rnpm link can work correctly.
read more information npm script
Comments
Post a Comment