talmobi/yt-play

Error: ENOENT: no such file or directory, open '/home/julian/.config/yarn/global/node_modules/chromium-all-codecs-bin/bin-path.txt'

maniqui opened this issue ยท 18 comments

Afer upgrading to v0.6.0, I'm getting:

$ yt-play
fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/home/julian/.config/yarn/global/node_modules/chromium-all-codecs-bin/bin-path.txt'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at Object.<anonymous> (/home/julian/.config/yarn/global/node_modules/chromium-all-codecs-bin/main.js:4:20)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)

BTW, thanks for creating this nifty little thing.

Hey,

Can you tell me which operating system you are using?

I'm using Debian Sid (Unstable).

@maniqui

Hello, I've published a patch v6.0.1 that fallbacks to default Chromium (same that puppeteer uses by default) for Linux.

npm install -g yt-play-cli@latest

Does this work for you?

@talmobi it seems to have fixed it :) Thanks.
Now, whenever I search for something, I briefly see the results and then it crashes with this error:

$ yt-play 
searching : computer world
> events.js:174
      throw er; // Unhandled 'error' event
      ^7) views: 455683 | Kraftwerk - Computer World - 5ybQWD6N6Zo
   (8:50) views: 102270 | Kraftwerk - Computer World / Home Computer - PbTT7F887BI
Error: read ECONNRESET3 | Kraftwerk - Numbers ComputerWorld [Live, 2004] HD - HTBxnOUM-Oc
    at Pipe.onStreamRead (internal/stream_base_commons.js:111:27)pgM
Emitted 'error' event at:| The new supercomputer behind the US nuclear arsenal - PS_PlorW6pM
    at emitErrorNT (internal/streams/destroy.js:91:8)hGERQI
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Let me know if you want me to report this as a separate issue.

Hmm. Not able to reproduce. Doesn't look like an issue with yt-play

Try npm install -g yt-search and yt-search computer world and see if the error comes up there also.

I have some overall fixes coming to yt-search soon, too.

Also please post your node -v and uname -a

Thanks~

hi @talmobi

Truth be told, I am using yarn to install yt-play-cli.
This is my normal environment:

julian@captain-blip:~$ node -v
v10.17.0
julian@captain-blip:~$ yarn -v
1.19.1
julian@captain-blip:~$ uname -a
Linux captain-blip 5.4.0-3-amd64 #1 SMP Debian 5.4.13-1 (2020-01-19) x86_64 GNU/Linux
julian@captain-blip:~$ yt-play 
searching : computer love
> events.js:174
      throw er; // Unhandled 'error' event
      ^6) views: 35070211 | Zapp & Roger - Computer Love - _aVa7qVKUHI
   (4:50) views: 2432691 | Zapp - Computer love 1985 (Virus Mix) - B84eiC8U_uk
Error: read ECONNRESETomputer Love - 1gI7s2ZCepI
    at Pipe.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:| Kraftwerk - Computer Love - ZtWTUt2RZh0
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Now, for testing purposes, I've created a Python virtual environment (using pipenv) and then, I've installed nodeenv on it, which allows me to install different versions of node. I've also installed yt-play-cli and yt-search there.
Here's some output:

(nodeenv) julian@captain-blip:~/src/nodeenv$ node -v
v13.7.0
(nodeenv) julian@captain-blip:~/src/nodeenv$ npm -v
6.13.7
(nodeenv) julian@captain-blip:~/src/nodeenv$ uname -a
Linux captain-blip 5.4.0-3-amd64 #1 SMP Debian 5.4.13-1 (2020-01-19) x86_64 GNU/Linux
(nodeenv) julian@captain-blip:~/src/nodeenv$ yt-play
searching : computer love
> events.js:298
      throw er; // Unhandled 'error' event
      ^6) views: 35070211 | Zapp & Roger - Computer Love - _aVa7qVKUHI
   (7:20) views: 3570547 | Kraftwerk - Computer Love - ZtWTUt2RZh0
Error: read ECONNRESETomputer Love - 1gI7s2ZCepI
    at Pipe.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Socket instance at:ove 1985 (Virus Mix) - B84eiC8U_uk
    at emitErrorNT (internal/streams/destroy.js:84:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}
(nodeenv) julian@captain-blip:~/src/nodeenv$ yt-search computer love
> 
  29/29 fuzzy mode ctrl-s to switch [0]
> Zapp & Roger - Computer Love (4:46) - _aVa7qVKUHI
  Zapp - Computer love 1985 (Virus Mix) (4:50) - B84eiC8U_uk
  Computer Love (4:44) - 1gI7s2ZCepI
  Computer Love (3:07) - 1JX2PeAneq8
  Kraftwerk - Computer Love (7:20) - ZtWTUt2RZh0
  Computer Love (4:45) - 33p698xbtc8

yt-search seems to work properly (if I hit the Enter key, I'll get a YouTube URL just fine).
yt-play is still throwing some (same?) error.

Thank you, will have an update soon.

@maniqui

Hey, new version 0.7.0 npm install -g yt-play-cli@latest that should work. It uses electron's Chromium version that can play more codecs (all youtube videos) that puppeteers default chromium can't play.

Does this version work for you?

@talmobi

I've upgraded to v0.7.1.
Although I'm no longer getting any error messages, once I pick a search result, I get some expected output (see below) and immediately after, the command line shows the prompt again.

(nodeenv) julian@captain-blip:~/src/nodeenv$ yt-play 
searching : john zorn tamalpais
playing   : c4eO2o9u1j0
url       : https://youtube.com/watch?v=c4eO2o9u1j0
 ------------------ 
John Zorn - Zorn@60 // Warsaw Summer Jazz Days 2013 // Sala Kongresowa, Warszawa, Poland
(nodeenv) julian@captain-blip:~/src/nodeenv$ 

This happens both in my "normal" environment (where I install yt-play using yarn), and on my nodeenv environment (where I install yt-play using npm).

@maniqui version v0.7.2 has been published that should fix these things.

npm install -g yt-play-cli@latest

The cli now exits after video has ended. If you give -c, --continue arg it will ask you again for a next search term after video ends.

Also this module now exposes a Node API to play youtube videos. See README for example.

Please let me know if it doesn't work for you, thanks~ 

@talmobi
I've upgrade to v0.7.2.
Now, immediately after running a search, as soon as results are listed, I'm sent back to the CLI prompt.

This happens both in my "normal" environment (where I install yt-play using yarn), and on my nodeenv environment (where I install yt-play using npm).
Let me know if there is any other info I can provide you with or some other steps to run/test.
Thanks for your time.

@maniqui Hmm.. can you try running:

debug=1 verbose=1 show=1 yt-play

The logs will clutter your search but type a search term in blind and press enter, then paste the logs, please.

Also does the electron browser window show up at all when you do this?

Thanks~

Sure, here's an screenshot for the output. It somewhat "breaks" the CLI, as once it sents me back to the CLI, the prompt overlaps the output of yt-play

image

Re: electron. No electron browser window shows up.

Hmm, haven't had much success reproducing the issue. Published a patched 0.7.3 version that init's electron only after a selection has been made. There may have been an issue of trying to play a video before electron was ready.

npm install -g yt-play-cli@latest

Tested on node -v v10.19.0 and a virtualbox ubuntu64

See if you can see and select videos from the list fine, and then after Enter if an error comes up.

System-wide installation using npm install -g yt-play-cli@latest

julian@captain-blip:~$ which node
/usr/bin/node
julian@captain-blip:~$ node --version
v10.17.0
julian@captain-blip:~$ debug=1 verbose=1 show=1 /usr/local/bin/yt-play
searching : zorn tamalpais
playing   : rXPEmZ-SUL4
url       : https://youtube.com/watch?v=rXPEmZ-SUL4
 ------------------ 
John Zorn - Tamalpais (for Elissa Guest) โ˜ผ
(node:379756) UnhandledPromiseRejectionWarning: Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at getElectronPath (/usr/local/lib/node_modules/yt-play-cli/node_modules/electron/index.js:14:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/yt-play-cli/node_modules/electron/index.js:18:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at /usr/local/lib/node_modules/yt-play-cli/node_modules/eleko/index.js:112:23
(node:379756) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:379756) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
eleko exited

User-wide installation using yarn global add yt-play-cli

julian@captain-blip:~$ which node
/usr/bin/node
julian@captain-blip:~$ node --version
v10.17.0
julian@captain-blip:~$ which yt-play 
/home/julian/.yarn/bin/yt-play
julian@captain-blip:~$ debug=1 verbose=1 show=1 /home/julian/.yarn/bin/yt-play
searching : zorn tamalpais
playing   : rXPEmZ-SUL4
url       : https://youtube.com/watch?v=rXPEmZ-SUL4
 ------------------ 
John Zorn - Tamalpais (for Elissa Guest) โ˜ผ
electron spawn exited, code: null
api.browser.close
eleko exited

Installation inside a pipenv+nodeenv (using npm install -g yt-play-cli@latest)

(nodeenv) julian@captain-blip:~/src/nodeenv$ which node
/home/julian/.local/share/virtualenvs/nodeenv-G2L0gq3n/bin/node
(nodeenv) julian@captain-blip:~/src/nodeenv$ node --version
v10.19.0
(nodeenv) julian@captain-blip:~/src/nodeenv$ which yt-play 
/home/julian/.local/share/virtualenvs/nodeenv-G2L0gq3n/bin/yt-play
(nodeenv) julian@captain-blip:~/src/nodeenv$ debug=1 verbose=1 show=1 /home/julian/.local/share/virtualenvs/nodeenv-G2L0gq3n/bin/yt-play
searching : zorn tamalpais
playing   : rXPEmZ-SUL4
url       : https://youtube.com/watch?v=rXPEmZ-SUL4
 ------------------ 
John Zorn - Tamalpais (for Elissa Guest) โ˜ผ
electron spawn exited, code: null
api.browser.close
eleko exited

Installation inside an Docker container (Ubuntu 18.04.4)

root@102abb7aba9d:/# which node
/usr/bin/node
root@102abb7aba9d:/# node --version
v8.10.0
root@102abb7aba9d:/# debug=1 verbose=1 show=1 yt-play 
searching : zorn tamalpais
playing   : rXPEmZ-SUL4
url       : https://youtube.com/watch?v=rXPEmZ-SUL4
 ------------------ 
John Zorn - Tamalpais (for Elissa Guest) โ˜ผ
(node:4378) UnhandledPromiseRejectionWarning: Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at getElectronPath (/usr/local/lib/node_modules/yt-play-cli/node_modules/electron/index.js:14:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/yt-play-cli/node_modules/electron/index.js:18:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /usr/local/lib/node_modules/yt-play-cli/node_modules/eleko/index.js:112:23
(node:4378) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:4378) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
eleko exited

Not sure if related, but when trying to run the cli.js for chrome-sandbox I get the following:

 /home/julian/.config/yarn/global/node_modules/electron/cli.js 
[384995:0314/094300.539888:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/julian/.config/yarn/global/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755

(I put the output only for the "yarn" environment, but it's similar for the "pipenv+nodeenv" environment).

I've chown'ed the executable to root and tried again, with no luck.

Similarly, I get the following output on the system-wide and Docker setups:

$ /usr/local/lib/node_modules/yt-play-cli/node_modules/electron/cli.js 
/usr/local/lib/node_modules/yt-play-cli/node_modules/electron/index.js:14
    throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
    ^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at getElectronPath (/usr/local/lib/node_modules/yt-play-cli/node_modules/electron/index.js:14:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/yt-play-cli/node_modules/electron/index.js:18:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/yt-play-cli/node_modules/electron/cli.js:3:16)

Hope it helps.
Thanks again for looking into this.

Did any previous version work for you?

Yes, some version previous to 0.6 worked for me.

Hmm. Maybe it worked for a short period where I was using the installed chrome version available on the system.

But yes if electron can't run then this won't run either at the moment.