npm create cloudflare: "no such file or directory lstat"

When attempting to create a new project using npm create cloudflare@latest, I get the following error after choosing the options I wanted:
PS E:\cf-projects> npm create cloudflare@latest

using create-cloudflare version 2.21.3

╭ Create an application with Cloudflare Step 1 of 3

├ In which directory do you want to create your application?
│ dir ./alterion-dev

├ What type of application do you want to create?
│ type Website or web app

├ Which development framework do you want to use?
│ framework Solid

├ Continue with Solid via `npx [email protected] -p alterion-dev -s`


npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\eslac\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\eslac\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\eslac\AppData\Local\npm-cache\_logs\2024-05-28T02_57_29_983Z-debug-0.log
╰ ERROR Error
npm ERR! code 1
npm ERR! path E:\cf-projects
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-cloudflare

npm ERR! A complete log of this run can be found in: C:\Users\eslac\AppData\Local\npm-cache\_logs\2024-05-28T02_56_57_300Z-debug-0.log
PS E:\cf-projects>
PS E:\cf-projects> npm create cloudflare@latest

using create-cloudflare version 2.21.3

╭ Create an application with Cloudflare Step 1 of 3

├ In which directory do you want to create your application?
│ dir ./alterion-dev

├ What type of application do you want to create?
│ type Website or web app

├ Which development framework do you want to use?
│ framework Solid

├ Continue with Solid via `npx [email protected] -p alterion-dev -s`


npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\eslac\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\eslac\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\eslac\AppData\Local\npm-cache\_logs\2024-05-28T02_57_29_983Z-debug-0.log
╰ ERROR Error
npm ERR! code 1
npm ERR! path E:\cf-projects
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-cloudflare

npm ERR! A complete log of this run can be found in: C:\Users\eslac\AppData\Local\npm-cache\_logs\2024-05-28T02_56_57_300Z-debug-0.log
PS E:\cf-projects>
Not quite sure what to do from here... I recall being able to create a cloudflare project with react, like, last week, but now this is broken.
19 Replies
<Alterion.Dev>
<Alterion.Dev>5mo ago
note: creating that folder (C:\Users\eslac\AppData\Roaming\) does work... but... why does it need to exist? it shouldn't be necessary. It ended up creating the project but finished with this
> build
> vinxi build

vinxi v0.3.11


⚙ Building your app...


📦 Compiling ssr router...
vinxi building router ssr in http mode
vite v5.2.11 building SSR bundle for production...
transforming...
✓ 37 modules transformed.
x Build failed in 648ms

ERROR [vite]: Rollup failed to resolve import "virtual:uno.css" from "E:/cf-projects/alterion-dev/src/app.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external

This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
at viteWarn (/E:/cf-projects/alterion-dev/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:67612:27)
at onRollupWarning (/E:/cf-projects/alterion-dev/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:67640:9)
at onwarn (/E:/cf-projects/alterion-dev/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:67356:13)
at /E:/cf-projects/alterion-dev/node_modules/rollup/dist/es/shared/node-entry.js:18514:13
at Object.logger [as onLog] (/E:/cf-projects/alterion-dev/node_modules/rollup/dist/es/shared/node-entry.js:20162:9)
at ModuleLoader.handleInvalidResolvedId (/E:/cf-projects/alterion-dev/node_modules/rollup/dist/es/shared/node-entry.js:19104:26)
at /E:/cf-projects/alterion-dev/node_modules/rollup/dist/es/shared/node-entry.js:19062:26



ERROR [vite]: Rollup failed to resolve import "virtual:uno.css" from "E:/cf-projects/alterion-dev/src/app.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external


npm ERR! code 1
npm ERR! path E:\cf-projects
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-cloudflare

npm ERR! A complete log of this run can be found in: C:\Users\eslac\AppData\Local\npm-cache\_logs\2024-05-28T03_01_20_972Z-debug-0.log
PS E:\cf-projects>
> build
> vinxi build

vinxi v0.3.11


⚙ Building your app...


📦 Compiling ssr router...
vinxi building router ssr in http mode
vite v5.2.11 building SSR bundle for production...
transforming...
✓ 37 modules transformed.
x Build failed in 648ms

ERROR [vite]: Rollup failed to resolve import "virtual:uno.css" from "E:/cf-projects/alterion-dev/src/app.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external

This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
at viteWarn (/E:/cf-projects/alterion-dev/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:67612:27)
at onRollupWarning (/E:/cf-projects/alterion-dev/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:67640:9)
at onwarn (/E:/cf-projects/alterion-dev/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:67356:13)
at /E:/cf-projects/alterion-dev/node_modules/rollup/dist/es/shared/node-entry.js:18514:13
at Object.logger [as onLog] (/E:/cf-projects/alterion-dev/node_modules/rollup/dist/es/shared/node-entry.js:20162:9)
at ModuleLoader.handleInvalidResolvedId (/E:/cf-projects/alterion-dev/node_modules/rollup/dist/es/shared/node-entry.js:19104:26)
at /E:/cf-projects/alterion-dev/node_modules/rollup/dist/es/shared/node-entry.js:19062:26



ERROR [vite]: Rollup failed to resolve import "virtual:uno.css" from "E:/cf-projects/alterion-dev/src/app.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external


npm ERR! code 1
npm ERR! path E:\cf-projects
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-cloudflare

npm ERR! A complete log of this run can be found in: C:\Users\eslac\AppData\Local\npm-cache\_logs\2024-05-28T03_01_20_972Z-debug-0.log
PS E:\cf-projects>
I dunno how to proceed here and I'm tired and annoyed, and this isn't a solid-start project like I wanted, so I'm going to let this go until tomorrow.
Walshy
Walshy5mo ago
@Dario is james in discord? if not, can you ping him internally
Dario
Dario5mo ago
@jculveyhouse 🙂 👆 surprisingly I just run npm create cloudflare@latest and created a solidStart project without encountering either of the above issues 😕
<Alterion.Dev>
<Alterion.Dev>5mo ago
No description
<Alterion.Dev>
<Alterion.Dev>5mo ago
I'll also point out that this exact error/warning on two different machines - my home machine on Windows 10 + Node 20, and also my work machine which is Windows 11, but defaults to node 18.16.1
<Alterion.Dev>
<Alterion.Dev>5mo ago
Ahhhhhhhh. This might explain it. Left is through npm create cloudflare , right is through npm create solid . The difference is key. Fixing the missing unocss plugin makes it work.
No description
<Alterion.Dev>
<Alterion.Dev>5mo ago
So, we had that one npm folder that doesn't exist in windows 10 (the first error didn't appear in windows 11), and we had that the missing vite plugin config. I got all the way to deploying, https://alterion-dev.pages.dev/ , works A-OK :AUthumbsup:
Dario
Dario5mo ago
Awesome! 😄 💪 what template are you using by the way? I guess the unoCSS issue should be fixed there? (the template I tried was the basic one and that doesn't seem to have this issue (since it does work on my machine! 😜))
<Alterion.Dev>
<Alterion.Dev>5mo ago
Yep, unocss was the template used. Sorry I thought it was actually showing in the log but I guess it didn't because that's the create-solid part not the cloudflare part?
Dario
Dario5mo ago
yeah it probably didn't show up there because the one you shared it the build output which happens after create-(cloudflare/solid) did their job 🙂
<Alterion.Dev>
<Alterion.Dev>5mo ago
yeah my bad on that one 😄
Dario
Dario5mo ago
by the way I think I know what's going wrong there...
Dario
Dario5mo ago
this is the generated config
No description
Dario
Dario5mo ago
I suspect that the unoCSS template contains the file in the correct way, then we update the config to include the cloudflare-pages preset and the rollup config (sorry I really can't remember if that's done by C3 or Solid itself... it's likely C3...), I bet that the problem is that the pre-existing config object is not merged with the new one, so we kind of drop the UnoCSS plugin setting in the process...
Dario
Dario5mo ago
as you can see we replace the defineConfig arguments instead of merging them.... sorry it's our bad then 😅👍
Dario
Dario5mo ago
if you want please open an issue in workers-sdk (https://github.com/cloudflare/workers-sdk/issues/new?assignees=&labels=bug&projects=&template=bug-template.yaml&title=%F0%9F%90%9B+BUG%3A) and I'll look into it when I can 🙂 (or if you prefer I can open the issue)
GitHub
Build software better, together
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.
From An unknown user
From An unknown user
From An unknown user
Dario
Dario5mo ago
I wasn't sure if you were going to do it (and was afraid of forgetting this problem 😅), so I created the issue 🙂👍 https://github.com/cloudflare/workers-sdk/issues/5949
GitHub
🐛 C3 BUG: C3 drops potential existing arguments in the SolidStart c...
Which Cloudflare product(s) does this pertain to? C3 What version(s) of the tool(s) are you using? C3 2.13.0 What version of Node are you using? 20 What operating system and version are you using? ...
Dario
Dario5mo ago
GitHub
[C3] fix: make sure that C3 doesn't delete pre-existing options in ...
What this PR solves / how to test Fixes #5949 Author has addressed the following Tests TODO (before merge) Included (except the e2e aspects which aren't actually currently tested in any way...
Want results from more Discord servers?
Add your server