unplugin-icons: Failed to read source code from /vercel/path0/_virtual_~icons/mdi/instagram.jsx
I get this when building on Vercel, and sometimes locally (using Nextjs). Redeploying usually fixes the issue
./_virtual_~icons/mdi/instagram.jsx
--
17:44:39.823 | Error: Failed to read source code from /vercel/path0/_virtual_~icons/mdi/instagram.jsx
17:44:39.824 |
17:44:39.824 | Caused by:
17:44:39.824 | No such file or directory (os error 2)
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 6
- Comments: 16
Still an issue in 2024. Any solutions other than disabling Next.js build caching all together?
@antfu can you fix this problem? as i see this bug very old
Same here. Super annoying. Have to remove node_modules and reinstall every time this happens.
This can help temporarily resolve the issue.
Same issue, been experiencing for months now
I have exactly the same issue with NextJs. The solution is to delete
.nextfolder and re-run the dev command. The problem is that it happens absolutely randomly – after the 5th or 10th re-launch of a project, which may make reproducing it an unobvious, but still doable, task. I have arranged a reproduction on Stackblitz – https://stackblitz.com/edit/stackblitz-starters-arrh29?file=pages%2Findex.js.npm run devcommand, and kill it again.It took me 5 attempts to finally get the error.
Need to note that on my local project, I have tried it with auto-import and it didn’t fix the problem.
Recently switched from the Iconify API to
unplugin-iconsand first experienced this issue after merging features afterunplugin-iconswas setup which smells like a Next caching issue. I get the same kinds of errors in a Vercel build and locally:Local build:
Vercel:
Same solution as pointed out by others. Locally I deleted the
.nextdirectory. In Vercel I re-ran the build without the build cache.Doing a bit of digging this may come from an incompatibility of the webpack-virtual-modules with Next’s caching (or possibly a bug in either). I am basing this exclusively on the
_virtual_part of the path which is defined byunpluginhere.unplugin-iconsconsumes this, so presumably this issue isn’t relevant to this repo and should be opened further up the chain.@antfu Could you please confirm?
I have the same issue from time to time with Nextjs locally. A fix for me is to delete the
.nextfolder and then rerunyarn run dev.