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

npm install errors and how to play? #527

Closed
extensionsapp opened this issue Dec 14, 2015 · 9 comments
Closed

npm install errors and how to play? #527

extensionsapp opened this issue Dec 14, 2015 · 9 comments

Comments

@extensionsapp
Copy link

@extensionsapp extensionsapp commented Dec 14, 2015

Debian GNU/Linux 7 (wheezy)
npm - 2.14.7
node - v4.2.2

# npm install webtorrent -g
npm WARN engine windows-no-runnable@0.0.6: wanted: {"node":"0.6"} (current: {"node":"4.2.2","npm":"2.14.7"})
npm WARN engine mdns-js@0.4.0: wanted: {"node":"^0.10.3 || ^0.12.0"} (current: {"node":"4.2.2","npm":"2.14.7"})
|
> utf-8-validate@1.2.1 install /usr/lib/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/4.2.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/node_modules/utf-8-validate/.node-gyp"
make: Entering directory `/usr/lib/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  COPY Release/validation.node
make: Leaving directory `/usr/lib/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/node_modules/utf-8-validate/build'

> bufferutil@1.2.1 install /usr/lib/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/4.2.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/node_modules/bufferutil/.node-gyp"
make: Entering directory `/usr/lib/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  COPY Release/bufferutil.node
make: Leaving directory `/usr/lib/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/node_modules/bufferutil/build'

> dtrace-provider@0.6.0 install /usr/lib/node_modules/webtorrent/node_modules/chromecasts/node_modules/node-ssdp/node_modules/bunyan/node_modules/dtrace-provider
> node scripts/install.js

/usr/bin/webtorrent -> /usr/lib/node_modules/webtorrent/bin/cmd.js
webtorrent@0.63.3 /usr/lib/node_modules/webtorrent
├── thunky@0.1.0
├── clivas@0.2.0
├── speedometer@1.0.0
├── range-parser@1.0.3
├── inherits@2.0.1
├── uniq@1.0.1
├── bitfield@1.1.2
├── random-iterate@1.0.1
├── memory-chunk-store@1.2.0
├── immediate-chunk-store@1.0.7
├── hat@0.0.3
├── torrent-piece@1.0.0
├── zero-fill@2.2.1
├── addr-to-ip-port@1.4.2
├── re-emitter@1.1.1
├── multistream@2.0.2
├── xtend@4.0.1
├── network-address@1.0.0
├── mediasource@1.0.0
├── mime@1.3.4
├── run-parallel@1.1.4
├── minimist@1.2.0
├── windows-no-runnable@0.0.6
├── debug@2.2.0 (ms@0.7.1)
├── simple-sha1@2.0.7 (rusha@0.8.3)
├── path-exists@2.1.0 (pinkie-promise@2.0.0)
├── end-of-stream@1.1.0 (once@1.3.3)
├── pump@1.0.1 (once@1.3.3)
├── ut_metadata@3.0.1 (bencode@0.7.0)
├── load-ip-set@1.2.4 (once@1.3.3, simple-get@1.4.3, ip-set@1.0.0, split@1.0.0)
├── nodebmc@0.0.5 (mdns-js@0.1.0)
├── ut_pex@1.0.3 (bencode@0.7.0, string2compact@1.2.2, compact2string@1.4.0)
├── bittorrent-dht@5.0.0 (isarray@0.0.1, buffer-equal@0.0.1, once@1.3.3, k-bucket@0.6.0, simple-get@1.4.3, is-ip@1.0.0, bencode@0.7.0, string2compact@1.2.2, compact2string@1.4.0)
├── cross-spawn-async@2.1.1 (lru-cache@3.2.0, which@1.2.0)
├── bittorrent-swarm@6.0.0 (simple-get@1.4.3, bittorrent-protocol@2.0.0)
├── parse-torrent@5.7.0 (get-stdin@5.0.1, magnet-uri@5.1.0, simple-get@1.4.3, blob-to-buffer@1.2.3, parse-torrent-file@3.3.0)
├── chunk-store-stream@2.0.1 (block-stream2@1.1.0)
├── create-torrent@3.18.1 (flatten@0.0.1, junk@1.0.2, is-file@1.0.0, once@1.3.3, bencode@0.7.0, piece-length@0.0.0, dezalgo@1.0.3, filestream@4.1.1, block-stream2@1.1.0)
├── executable@2.1.0 (pify@2.3.0, pinkie-promise@1.0.0, meow@3.6.0)
├── pretty-bytes@2.0.1 (get-stdin@4.0.1, number-is-nan@1.0.0, meow@3.6.0)
├── moment@2.10.6
├── videostream@1.2.1 (mp4box@0.1.0)
├── inquirer@0.11.0 (strip-ansi@3.0.0, ansi-regex@2.0.0, ansi-escapes@1.1.0, figures@1.4.0, cli-width@1.1.0, rx-lite@3.1.2, through@2.3.8, chalk@1.1.1, cli-cursor@1.0.2, readline2@1.0.1, run-async@0.1.0, lodash@3.10.1)
├── airplay-js@0.2.16 (mdns-js@0.4.0, plist@1.2.0)
├── fs-chunk-store@1.3.4 (path-exists@1.0.0, random-access-file@0.3.1, mkdirp@0.5.1, rimraf@2.4.4, cuid@1.3.8)
├── torrent-discovery@4.0.1 (bittorrent-tracker@6.3.2)
└── chromecasts@1.5.4 (multicast-dns@2.2.0, request@2.67.0, castv2-client@1.1.0, xml2js@0.4.15, node-ssdp@2.6.5)

Next:

# browserify main.js -o bundle.js

main.js

var WebTorrent = require('webtorrent');

var client = new WebTorrent();

var torrentId = 'magnet:?xt=urn:btih:976674fc52bb8e61499e701033a5a4759b5f0d60';

client.add(torrentId, function (torrent) {

    console.log(torrent);

    var file = torrent.files[0];
    file.appendTo('body');
});

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>

</body>

<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>

<script src="bundle.js"></script>

</html>

How to play?

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Dec 14, 2015

You don't need to bundle if you are already using the minified standalone file. (You could remove the first line) and use your main.js

About the errors, are you using nvm? I can't imagine another reason as to why root couldn't access /root/.node-gyp/4.2.2

@extensionsapp

This comment has been minimized.

Copy link
Author

@extensionsapp extensionsapp commented Dec 14, 2015

I not using nvm and it is necessary?
I use main.js, but empty page.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Dec 14, 2015

Does the torrent gets logged in the browser?

I can download it here: https://btorrent.xyz/#976674fc52bb8e61499e701033a5a4759b5f0d60

You don't need to install WebTorrent's npm package. You can use the webtorrent.min.js

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>

</body>

<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>

<script src="main.js"></script>

</html>

main.js

var client = new WebTorrent();

var torrentId = 'magnet:?xt=urn:btih:976674fc52bb8e61499e701033a5a4759b5f0d60';

client.add(torrentId, function (torrent) {

    console.log(torrent);

    var file = torrent.files[0];
    file.appendTo('body');
});

JSFiddle here: http://jsfiddle.net/zm1kvkno/

@gillesdemey

This comment has been minimized.

Copy link
Contributor

@gillesdemey gillesdemey commented Dec 14, 2015

If you're using root try adding --unsafe-perm when installing dependencies and chown the node-gyp folder.

There's an ancient issue regarding this behaviour nodejs/node-gyp#454

@extensionsapp

This comment has been minimized.

Copy link
Author

@extensionsapp extensionsapp commented Dec 14, 2015

It works only your example

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Dec 14, 2015

Ah, that explains why. This has been answered many times.

It's because WebTorrent in the browser cannot connect to TCP/uTP peers. Public torrents are seeded mostly by desktop clients and are not in the webrtc network.

Check this:
https://github.com/feross/webtorrent/blob/master/img/network.png

webtorrent/instant.io#93 Is very similar

@extensionsapp

This comment has been minimized.

Copy link
Author

@extensionsapp extensionsapp commented Dec 14, 2015

# npm install webtorrent-hybrid
\
> wrtc@0.0.58 install /home/db/node_modules/webtorrent-hybrid/node_modules/wrtc
> node-pre-gyp install --fallback-to-build

gyp: /root/.node-gyp/4.2.2/common.gypi not found (cwd: /home/db/node_modules/webtorrent-hybrid/node_modules/wrtc) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.2.0-4-amd64
gyp ERR! command "/usr/bin/nodejs" "/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/build/wrtc/v0.0.58/Release/node-v46-linux-x64/wrtc.node" "--module_name=wrtc" "--module_path=/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/build/wrtc/v0.0.58/Release/node-v46-linux-x64"
gyp ERR! cwd /home/db/node_modules/webtorrent-hybrid/node_modules/wrtc
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/build/wrtc/v0.0.58/Release/node-v46-linux-x64/wrtc.node --module_name=wrtc --module_path=/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/build/wrtc/v0.0.58/Release/node-v46-linux-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/node_modules/node-pre-gyp/lib/util/compile.js:73:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Linux 3.2.0-4-amd64
node-pre-gyp ERR! command "/usr/bin/nodejs" "/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/db/node_modules/webtorrent-hybrid/node_modules/wrtc
node-pre-gyp ERR! node -v v4.2.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.4
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/nodejs /home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/build/wrtc/v0.0.58/Release/node-v46-linux-x64/wrtc.node --module_name=wrtc --module_path=/home/db/node_modules/webtorrent-hybrid/node_modules/wrtc/build/wrtc/v0.0.58/Release/node-v46-linux-x64' (1)
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "webtorrent-hybrid"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! wrtc@0.0.58 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wrtc@0.0.58 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the wrtc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls wrtc
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/db/npm-debug.log

webtorrent-hybrid dont install.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Dec 14, 2015

You can't use webtorrent-hybrid in a website. If you are simply trying to stream a torrent to your pc just use webtorrent download '<HASH>' --vlc this will stream the torrent to VLC

You cannot stream public torrents to a website using WebTorrent.

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 5, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.