I have a package.json
script like:
{ "export": "next export", "build": "next build && npm run export && npm run build:rss", "build:rss": "node ./.next/server/scripts/build-rss.js", "start": "next start", }
It has build:rss
which points to ./.next/server/scripts/build-rss.js
but it cannot find it on Vercel. How do I point it correctly on Vercel? I get the following error & cannot deploy my site:
> node ./.next/server/scripts/build-rss.js 15:14:05.786 internal/modules/cjs/loader.js:968 15:14:05.786 throw err; 15:14:05.786 ^ 15:14:05.786 Error: Cannot find module '/vercel/workpath0/.next/server/scripts/build-rss.js' 15:14:05.786 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15) 15:14:05.786 at Function.Module._load (internal/modules/cjs/loader.js:841:27) 15:14:05.786 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) 15:14:05.786 at internal/main/run_main_module.js:17:47 {
I tried asking Vercel support but they said:
I recommend doing something like this → https://github.com/pacocoursey/paco/blob/master/package.json. I’m afraid we do not provide complete code-level support for users on the Hobby plan.
Not sure the link is relevant 🙁
Advertisement
Answer
I had to change server
to serverless
to make it work on Vercel 🙂