Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: bundling failed: ambiguous resolution: module .../index.js tries to require react-native, but there are several files providing this module. You can delete or fix them #89

Closed
jerinho opened this issue Nov 27, 2018 · 2 comments

Comments

@jerinho
Copy link

jerinho commented Nov 27, 2018

i had follow the installation instruction properly

  1. uninstall default package. npm remove react-native-create-library
  2. install new package from here. npm i -g git+https://github.com/frostney/react-native-create-library.git

C:\Users\USER\AppData\Roaming\npm\react-native-create-library -> C:\Users\USER\AppData\Roaming\npm\node_modules\react-native-create-library\cli.js
[email protected]
added 91 packages from 39 contributors in 82.13s

  1. react-native-create-library mylib

While RN is the default prefix, it is recommended to customize the prefix.
While {DEFAULT_PACKAGE_IDENTIFIER} is the default package identifier, it is recommended to customize the package identifier.
📚 Created library testlib in ./testlib.
🕘 It took 112ms.
➡️ To get started type cd ./testlib and run npm install

  1. testlib directory not exists. the name is react-native-testlib. so i do cd ./react-native-testlib instead. followed by yarn

yarn install v1.9.4
info No lockfile found.
[1/4] Resolving packages...
warning react-native > [email protected]: connect 2.x series is deprecated
info There appears to be trouble with your network connection. Retrying...
warning react-native-windows > yeoman-generator > cross-spawn > [email protected]: cross-spawn no longer requires a build toolchain, use it instead
warning react-native-windows > yeoman-generator > download > gulp-decompress > [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
warning react-native-windows > yeoman-generator > sinon > [email protected]: This package is unmaintained. Use @sinonjs/formatio instead
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 307.98s.

  1. yarn link

yarn link v1.9.4
success Registered "react-native-testlib".
info You can now run yarn link "react-native-testlib" in the projects where you want to use this package and it will be used instead.
Done in 0.12s.

  1. yarn link react-native-testlib on project directory

yarn link v1.9.4
success Using linked package for "react-native-testlib".
Done in 0.15s.

  1. react-native link react-native-testlib. expected automatic installation works perfectly as manual installation. but it's not. so i have to do it manually

  2. react-native run-android working as expected for android part. but metro bundler show compilation error

error: bundling failed: ambiguous resolution: module C:\Users\USER\Desktop\test\index.js tries to require react-native, but there are several files providing this module. You can delete or fix them:
*C:\Users\USER\AppData\Local\Yarn\Data\link\react-native-testlib\node_modules\react-native\package.json
*C:\Users\USER\Desktop\test\node_modules\react-native\package.json

@maicki
Copy link
Contributor

maicki commented Nov 27, 2018

@jerinho Unfortunately you cannot symlink a react native package. This is a problem with the metro bundler and you can follow the issue here: facebook/metro#1

@maicki maicki closed this as completed Nov 27, 2018
@jerinho
Copy link
Author

jerinho commented Nov 28, 2018

@jerinho Unfortunately you cannot symlink a react native package. This is a problem with the metro bundler and you can follow the issue here: facebook/metro#1

thank you. but then yarn should not loads packages into node_modules directory. just like how the default "outdated" react-native-create-library works. please kindly let me know if anybody get different result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants