jd20 / SimplePeerDemo

1 stars 2 forks source link

Can't run demo #1

Open nazar-pc opened 6 years ago

nazar-pc commented 6 years ago

I've never worked with Android, so this might be a trivial question, but nevertheless.

I've enabled adb usb debugging on my phone and started adb server, adb sees my phone without issues:

nazar-pc@nazar-pc /m/D/П/A/N/platform-tools> ./adb devices
List of devices attached
8XV7N16128000093    device

How I'm trying to run the demo:

nazar-pc@nazar-pc /w/g/SimplePeerDemo> yarn
yarn install v1.2.1
warning You are using Node "9.4.0" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || ^8.0.0"
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native-level-fs@3.0.0" has unmet peer dependency "asyncstorage-down@^3.0.0".
warning "babel-jest@22.1.0" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0".
[4/4] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.3.2" while you're on "1.2.1".
info To upgrade, run the following command:
$ curl -o- -L https://yarnpkg.com/install.sh | bash
Done in 35.54s.
nazar-pc@nazar-pc /w/g/SimplePeerDemo> node_modules/.bin/react-native run-android
Scanning folders for symlinks in /web/github/SimplePeerDemo/node_modules (7ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

The link in error points to 404 page.

What else do I need to do to run this? I'm on Linux (Ubuntu 18.04) and I have Nexus 6P.

I don't have Android studio and the rest of the development stack and I'd like to not installing all of that just to run a few lines of JS.

nazar-pc commented 6 years ago

Ping

jd20 commented 6 years ago

Just googling the error you're seeing, I'm thinking something messed up with gradle setup on your machine, that probably gets taken care of automatically when installing Android Studio and setting it up for RN development, according to Facebook's instructions. If you want to avoid installing android studio, and still run a RN app, you probably need help from someone more experienced on the Android side of RN, I'm mostly only familiar with the iOS side.

nazar-pc commented 6 years ago

If someone will find this issue using search, I did the following:

However, I still got following:

Metro Bundler ready.

Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `stream` from `/web/github/SimplePeerDemo/node_modules/browserify-sign/browser/index.js`: Module does not exist in the module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset Metro Bundler cache: `rm -rf $TMPDIR/react-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf $TMPDIR/haste-map-react-native-packager-*`.
    at ModuleResolver.resolveDependency (/web/github/SimplePeerDemo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:311:1719)
    at ResolutionRequest.resolveDependency (/web/github/SimplePeerDemo/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:96:16)
    at DependencyGraph.resolveDependency (/web/github/SimplePeerDemo/node_modules/metro/src/node-haste/DependencyGraph.js:269:4352)
    at /web/github/SimplePeerDemo/node_modules/metro/src/DeltaBundler/traverseDependencies.js:201:36
    at Generator.next (<anonymous>)
    at step (/web/github/SimplePeerDemo/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:306)
    at /web/github/SimplePeerDemo/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:536
    at new Promise (<anonymous>)
    at /web/github/SimplePeerDemo/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:217
    at addDependency (/web/github/SimplePeerDemo/node_modules/metro/src/DeltaBundler/traverseDependencies.js:256:92)
 BUNDLE  [android, dev] ./index.js ▓▓▓▓▓▓▓▓░░░░░░░░ 54.5% (400/542), failed.

@jd20, I've spent a lot of time to get this far, do you have an idea what is wrong now?

nazar-pc commented 6 years ago

There is something wrong with this app, I've created new project and got "Welcome to React Native". Did you try to run this app from cloned repository in another directory?

jd20 commented 6 years ago

I’m pretty sure I tried from a cloned repository, after following the steps in the README. Let me take a look today, and see if I can repro what you are seeing, I’ll report back.

haidoan commented 6 years ago

I had same error as @nazar-pc , and get rid of it by following bkonkle's comment from this closed issue #109 https://github.com/feross/simple-peer/issues/109. I tested on ios.