Cloudflare Could not load virtual:astro-icon

I was trying to update something on my cloudflare pages site, and suddenly I'm getting the following error. All I did was change an HTML lang tag. I'm guessing Astro Icons have changed in some way since 2 months ago?
17:21:39.655 > astro build
17:21:39.655
17:21:42.210 10:21:42 PM [content] Types generated 249ms
17:21:42.211 10:21:42 PM [build] output target: static
17:21:42.211 10:21:42 PM [build] Collecting build info...
17:21:42.212 10:21:42 PM [build] Completed in 609ms.
17:21:42.214 10:21:42 PM [build] Building static entrypoints...
17:21:44.689 [astro-icon] Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.976 error Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.976 TypeError: Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.977 at logCollections (file:///opt/buildhome/repo/node_modules/astro-icon/dist/vite-plugin-astro-icon.js:46:12)
17:21:44.977 at Object.load (file:///opt/buildhome/repo/node_modules/astro-icon/dist/vite-plugin-astro-icon.js:30:17)
17:21:44.977 at async PluginDriver.hookFirstAndGetPlugin (file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:25444:28)
17:21:44.977 at async file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:24611:75
17:21:44.977 at async Queue.work (file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:25654:32)
17:21:45.067 Failed: build command exited with code: 1
17:21:46.003 Failed: error occurred while running build command
17:21:39.655 > astro build
17:21:39.655
17:21:42.210 10:21:42 PM [content] Types generated 249ms
17:21:42.211 10:21:42 PM [build] output target: static
17:21:42.211 10:21:42 PM [build] Collecting build info...
17:21:42.212 10:21:42 PM [build] Completed in 609ms.
17:21:42.214 10:21:42 PM [build] Building static entrypoints...
17:21:44.689 [astro-icon] Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.976 error Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.976 TypeError: Could not load virtual:astro-icon (imported by node_modules/astro-icon/components/Icon.astro): Cannot read properties of undefined (reading 'info')
17:21:44.977 at logCollections (file:///opt/buildhome/repo/node_modules/astro-icon/dist/vite-plugin-astro-icon.js:46:12)
17:21:44.977 at Object.load (file:///opt/buildhome/repo/node_modules/astro-icon/dist/vite-plugin-astro-icon.js:30:17)
17:21:44.977 at async PluginDriver.hookFirstAndGetPlugin (file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:25444:28)
17:21:44.977 at async file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:24611:75
17:21:44.977 at async Queue.work (file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:25654:32)
17:21:45.067 Failed: build command exited with code: 1
17:21:46.003 Failed: error occurred while running build command
Deployment works on my machine with the same version of Node and npm as Cloudflare. Any ideas?
1 Reply
greenappleFF
greenappleFF10mo ago
Yes, Astro Icons changed. It now generates the types for your @iconify icons in the .astro folder. Probably you have something like "astro check && astro build" in your package.json's build command. -> Types are checked before beeing generated Change it to "astro sync && astro check && astro build" If you delete your .astro folder locally, you should be able to replicate this issue on your local machine as well. It is not uploaded to cloudflare as it is in .gitignore - as it should be
Want results from more Discord servers?
Add your server