pmndrs / react-three-next

React Three Fiber, Threejs, Nextjs starter
https://react-three-next.vercel.app/
MIT License
2.52k stars 342 forks source link

yarn create with typescript cause error #119

Closed Suprhimp closed 1 year ago

Suprhimp commented 1 year ago

I test with without command -ts or --typescript, it works well.

When I try to create with typescript it cause this error.

 > Success! Folder and files created for pathTraceTest 

> Installing packages... 

> Success! Installed dependencies for pathTraceTest 

> Installing packages for TypeScript... 

> Success! Installed dependencies for TypeScript 

> Initializing for TypeScript... 

> Success! Succeed to initialize for TypeScript 

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, scandir '/Users/planningo/planningo/pathTraceTest/app'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/Users/planningo/planningo/pathTraceTest/app'
}

Node.js v18.0.0
error Command failed.
Exit code: 1
Command: /usr/local/bin/create-r3f-app
Arguments: next pathTraceTest tailwind -ts
Directory: /Users/planningo/planningo
Output:

I tried install node-sass and npm rebuild node-sass but it wasn't helped when I look generated project it has no /app directory also.(I think it is not needed right?)

blairjordan commented 1 year ago

Cursory glance here reveals a possible source of the issue.

Edit: Yeah, seems to be it. Bandaid fix 🩹:

git clone https://github.com/utsuboco/create-r3f-app && cd create-r3f-app

Edit this function: https://github.com/utsuboco/create-r3f-app/blob/acbfd0829f1fc41691934624f35e779a70e57ece/lib/stacks/next.js#L93

const initForTypeScript = async (root, rootFolder) => {
  // Add this
  fs.mkdir('app', (err) => {
    if (err) throw err;
  });

Run with:

node bin/create-r3f-app next myproject
 tailwind -ts 
RenaudRohlinger commented 1 year ago

Thanks! Just published a patch with this fix on create-r3f-app.

https://github.com/utsuboco/create-r3f-app/commit/320feb79ac293aab49f4419b7370b2238c37dc82

Should also fix #125