winsoroaks
winsoroaks9mo ago

Adding deps to node.externalPackages didn't resolve the error

Hi team! im running in to the error below
✘ [ERROR] Could not resolve "youtubei.js"

node_modules/langchain/dist/document_loaders/web/youtube.js:2:26:
2 │ import { Innertube } from "youtubei.js";
✘ [ERROR] Could not resolve "youtubei.js"

node_modules/langchain/dist/document_loaders/web/youtube.js:2:26:
2 │ import { Innertube } from "youtubei.js";
tried a few variations
// convex.json
{
"node": {
"externalPackages": [
"langchain" // "youtube-transcript", "youtubei.js"
]
}
}
// convex.json
{
"node": {
"externalPackages": [
"langchain" // "youtube-transcript", "youtubei.js"
]
}
}
but didnt fix the issue
Uncaught Failed to analyze ingest/load.js: Cannot find package 'youtube-transcript' imported from /tmp/external_deps/e9a05690-196f-40ed-88a7-cd46f4362a76/node_modules/langchain/dist/document_loaders/web/youtube.js
Uncaught Failed to analyze ingest/load.js: Cannot find package 'youtubei.js' imported from /tmp/external_deps/834ceee9-83db-4a8b-9907-c6805d171626/node_modules/langchain/dist/document_loaders/web/youtube.js
Uncaught Failed to analyze ingest/load.js: Cannot find package 'youtube-transcript' imported from /tmp/external_deps/e9a05690-196f-40ed-88a7-cd46f4362a76/node_modules/langchain/dist/document_loaders/web/youtube.js
Uncaught Failed to analyze ingest/load.js: Cannot find package 'youtubei.js' imported from /tmp/external_deps/834ceee9-83db-4a8b-9907-c6805d171626/node_modules/langchain/dist/document_loaders/web/youtube.js
any idea what's wrong? thank you.
6 Replies
ballingt
ballingt9mo ago
The name of this package looks like "youtubei", not "youtubei.js" based on https://www.npmjs.com/package/youtubei — this name should match the name of the package in your package.json file.
npm
youtubei
Simple package to get information from youtube such as videos, playlists, channels, video information & comments, related videos, up next video, and more!. Latest version: 1.3.7, last published: 9 days ago. Start using youtubei in your project by running npm i youtubei. There are 17 other projects in the npm registry using youtubei.
ballingt
ballingt9mo ago
If that doesn't work let us know, it could be that packages with imports that are different than the name of their packages don't work correctly here.
winsoroaks
winsoroaksOP9mo ago
thanks tom. my bad, i tried that too and it didnt work, forgot to include hmm i didnt install that pkg explicitly, i think it comes with langchain installed. lemme try installing it yea didnt work too hi tom, did u have the chance to look into it? im working off the starter code from convex, changing the import here https://github.com/get-convex/convex-ai-chat-langchain/blob/main/convex/ingest/load.ts#L5 to
import { YoutubeLoader } from 'langchain/document_loaders/web/youtube'
import { YoutubeLoader } from 'langchain/document_loaders/web/youtube'
sshader
sshader9mo ago
There is confusingly also a youtubei.js package: https://www.npmjs.com/package/youtubei.js I think I was able to get a successful npx convex dev by running npm install youtube-transcript youtubei.js and setting externalPackages: ["youtube-transcript", "youtubei.js"]? Curious if that works for you I don't have a great understanding for why npm install langchain + the externalPackages: ["langchain"] was not enough
npm
youtubei.js
A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).. Latest version: 9.2.0, last published: 4 days ago. Start using youtubei.js in your project by running npm i youtubei.js. There are 32 other projects in the npm registry using youtubei.js.
ballingt
ballingt9mo ago
oh sorry about that re package name vs import name! I was confused here.
winsoroaks
winsoroaksOP9mo ago
thank you sarah, you saved me!! no prob. thanks for helping to look into it!

Did you find this page helpful?