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

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for #58

Open
dench1k opened this issue Aug 5, 2023 · 10 comments
Open

Comments

@dench1k
Copy link

dench1k commented Aug 5, 2023

Hey, Josh. I've updated the package for the recent version and now for every download attempt an error. Here's my stacktrace:
`λ ytdl-mp3 https://www.youtube.com/watch?v=ZAjKsE5MNeU
node:internal/errors:465
ErrorCaptureStackTrace(err);
^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for C:\Users\admin\AppData\Roaming\npm\node_modules\ytdl-mp3\bin\ytdl-mp3. Loading extensionless files is not supported inside of "type":"module" package.json contexts. The package.json file C:\Users\admin\AppData\Roaming\npm\node_modules\ytdl-mp3\package.json caused this "type":"module" context. Try changing C:\Users\admin\AppData\Roaming\npm\node_modules\ytdl-mp3\bin\ytdl-mp3 to have a file extension. Note the "bin" field of package.json can point to a file with an extension, for example {"type":"module","bin":{"ytdl-mp3":".\bin\ytdl-mp3.js"}}
at new NodeError (node:internal/errors:372:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:80:11)
at defaultGetFormat (node:internal/modules/esm/get_format:122:38)
at defaultLoad (node:internal/modules/esm/load:21:20)
at ESMLoader.load (node:internal/modules/esm/loader:431:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:350:22)
at new ModuleJob (node:internal/modules/esm/module_job:66:26)
at #createModuleJob (node:internal/modules/esm/loader:369:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:328:34)
at async Promise.all (index 0) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'`

Node.js v18.0.0

@dench1k
Copy link
Author

dench1k commented Aug 6, 2023

@joshunrau
Copy link
Owner

Thanks for the report. I will investigate tmr.

@joshunrau
Copy link
Owner

Hi sorry for the delay. Have been very busy lately. This should be fixed in the latest version :)

@dench1k
Copy link
Author

dench1k commented Sep 5, 2023

Hi! Thanks for the feedback and your time. I will check the latest version in the evening :)

@dench1k
Copy link
Author

dench1k commented Sep 7, 2023

λ ytdl-mp3 https://www.youtube.com/watch?v=te6EdjqdzPA
ERROR: Failed to fetch info for video with URL: https://www.youtube.com/watch?v=te6EdjqdzPA

@dench1k
Copy link
Author

dench1k commented Sep 7, 2023

This is my log after update :(

@dench1k
Copy link
Author

dench1k commented Sep 7, 2023

Actually there's no npm after my update and I can't do anything related to npm. Everytime this error:

npm list -g npm
evalmachine.:43
} = primordials;
^

ReferenceError: primordials is not defined
at evalmachine.:43:5
at Object. (C:\Users\admin\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:1)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at Object. (C:\Users\admin\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (node:internal/modules/cjs/loader:1241:14)

Node.js v20.6.0

Probably I typed something wrong, dunno.

@joshunrau
Copy link
Owner

@dench1k try downgrading to node v20.51. At my work, we are having lots of problems with v20.6 due to some changes related to env variables. Could be it

@dench1k
Copy link
Author

dench1k commented Sep 11, 2023

The error above was due to some npm crush on my system after trying to revert npm version. As a result, I couldn't do any command with npm (even to check the current version). Spent the whole Friday's evening to fix the issue and the only solution was:

  • to completely delete the npm folder in %AppData%\npm\
  • download the latest https://github.com/npm/cli/releases/latest
  • paste this to %AppData%\npm\
  • run npm i -g npm

That's how I've got the latest npm and node version together, so at least it works on the system. Today I started to test this setup with the lastest package vesion of ytdl-mp3 and result was the same:
` ytdl-mp3 https://youtu.be/Y9yHZ-Gwdk8?si=EUy9ULhB6Jr-FAWU

ERROR: Failed to fetch info for video with URL: https://youtu.be/Y9yHZ-Gwdk8?si=EUy9ULhB6Jr-FAWU`

Tried to revert to [email protected] and [email protected] versions, but got "old" errors too (which is quite obvious I guess). The only current soluton was reverting to [email protected] of the package, sadly. The only thing I haven't tested is reverting to the prev. version of node (which you suggested - node v20.51), because at home I don't have nvm on a windows machine. Hope this feedback will be helpful and thank you for your time, Joshua

@joshunrau
Copy link
Owner

Hey,

So, I added a verbose option a little while back. You can use it like this:

❯ ytdl-mp3 --verbose "https://www.youtube.com/watch\?v\=Y9yHZ-Gwdk8"
Error: No video id found: "https://www.youtube.com/watch\?v\=Y9yHZ-Gwdk8"
    at exports.getURLVideoID (/Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/node_modules/ytdl-core/lib/url-utils.js:36:11)
    at exports.getVideoID (/Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/node_modules/ytdl-core/lib/url-utils.js:61:20)
    at exports.<computed> [as getInfo] (/Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/node_modules/ytdl-core/lib/info.js:484:29)
    at _Downloader.<anonymous> (/Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/dist/index.cjs:210:56)
    at Generator.next (<anonymous>)
    at /Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/dist/index.cjs:46:61
    at new Promise (<anonymous>)
    at __async (/Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/dist/index.cjs:30:10)
    at _Downloader.downloadSong (/Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/dist/index.cjs:206:12)
    at main (/Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/bin/ytdl-mp3.cjs:23:22)
YtdlMp3Error: Failed to fetch info for video with URL: https://www.youtube.com/watch\?v\=Y9yHZ-Gwdk8
    at /Users/joshua/.nvm/versions/node/v20.5.1/lib/node_modules/ytdl-mp3/dist/index.cjs:211:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ERROR: Failed to fetch info for video with URL: https://www.youtube.com/watch\?v\=Y9yHZ-Gwdk8

As you can see, the problem is Error: No video id found: "https://www.youtube.com/watch\?v\=Y9yHZ-Gwdk8". Right now I am swamped and don't have time to figure this out atm since it seems to only be a problem with this video. However, if you want to look into the ytdl-core docs and implement a PR to fix it would be greatly appreciated!

@joshunrau joshunrau reopened this Sep 15, 2023
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