MOHAMMAD-NAYAN / nayan-media-downloader

12 stars 7 forks source link

works with next.js? #22

Open nawed2611 opened 4 hours ago

nawed2611 commented 4 hours ago

I'm working with Next.js pages router - wrote an API route using this package got this on post deployment (works fine on local, issue with node.js env?)

⨯ Error: Cannot find module 'got'
Require stack:
- /var/task/node_modules/nayan-media-downloader/src/index.js
- /var/task/.next/server/pages/api/download.js
- /var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js
- /var/task/___next_launcher.cjs
- /opt/rust/nodejs.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at /var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:11:25613
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at /opt/rust/nodejs.js:1:11700
    at Function.ar (/opt/rust/nodejs.js:1:12074)
    at e.<computed>.te._load (/opt/rust/nodejs.js:1:11670)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at b.require (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:11:25829)
    at require (node:internal/modules/helpers:177:18)
    at eval (eval at <anonymous> (/var/task/node_modules/nayan-media-downloader/src/index.js:1:495), <anonymous>:1:1122) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/nayan-media-downloader/src/index.js',
    '/var/task/.next/server/pages/api/download.js',
    '/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js',
    '/var/task/___next_launcher.cjs',
    '/opt/rust/nodejs.js'
  ]
}
nawed2611 commented 4 hours ago

I tried npm i got to potentially solve this, had no luck