Cannot find package 'lru-cache' error happened when deployed in production

Hello, Vercel support teams,

I am using Octokit to build my portfolio to show my repos from Github, and today I accessed the website that deployed on Vercel and I got the error info as the following:

[nuxt] [request error] [unhandled] [500] Cannot find package 'lru-cache' imported from /var/task/node_modules/@octokit/auth-app/dist-node/index.js

Here is my repo’s link, I wrote all of the codes that depends on Octokit in the Server -> api -> repo folder

Here is the reproduction

Here is the issue that I opened in Octokit and a maintainer sir said it seems look like a Vercel BUG

The error is shown in the Vercel log and it works properly locally, I have no idea about it, I tried to redeploy on Vercel but it doesn’t work.

My Octokit version is 4.0.2. It works properly with this version in local.

Deployment URL or Custom Domain: https://nano-portfolio-ruby.vercel.app/index
Environment (local, preview, production): https://nano-portfolio-ruby.vercel.app/index
Project Framework: Nuxt3
Build Settings:
  Framework Preset: default
  Build Command (if not default):
  Output Directory (if not default):
  Install Command (if not default):
Node/Runtime Version: NodeJS 20.X LTS
Package Manager: PNPM
Relevant Packages: `Octokit` `Nuxt` `Vercel`

I would very much appreciate any help!! Thank you so much!!

And I have redeployed the project, the behavior seems can reinstall and reload all of the packages that the project depending on.

And I also regenerated the Github Token but still doesn’t work

Hello and welcome to the Vercel Community, @gaomingzhao666!

Thanks for your patience with us on getting back to you :pray:

I checked all your links and found that you’ve now fixed this, I’ll cross-post your comment from GitHub in case anyone else encounters a similar issue.

The issue was solved by installing @octokit/core instead of octokit.js, I do not know why it happened and where the problem should be addressed.
I found the issue but regenerate lockfile or redeploy project can not handle this.
The codes that explicitly point out the lost file path as following:
// relate to issue Some files were not copied to .output/server/node_modules during build · Issue #22325 · nuxt/nuxt · GitHub nitro: { externals: { traceInclude: } },

I’ll go ahead and mark this as the solution!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.