nicoalbanese / kirimase

Build full-stack Next.js apps, incredibly fast
https://kirimase.dev
MIT License
2.64k stars 122 forks source link

Errors when running generate #32

Closed peterarusanoff closed 1 year ago

peterarusanoff commented 1 year ago

Every time i run generate I get the error ENOENT: no such file or directory, open 'src/app/layout.tsx'

Error: ENOENT: no such file or directory, open 'src/app/layout.tsx'
    at Object.openSync (node:fs:601:3)
    at Object.readFileSync (node:fs:469:35)
    at addContextProviderToLayout (file:///nvm/versions/node/v18.16.1/lib/node_modules/kirimase/dist/commands/add/utils.js:17:28)
    at addNextAuth (file:///nvm/versions/node/v18.16.1/lib/node_modules/kirimase/dist/commands/add/auth/next-auth/index.js:67:5)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async addPackage (file:///nvm/versions/node/v18.16.1/lib/node_modules/kirimase/dist/commands/add/index.js:36:17) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'src/app/layout.tsx'
}
nicoalbanese commented 1 year ago

Hey Peter - double check that you set up kirimase init correctly regarding whether you have a src folder or not (you can see this in the kirimase.config.json file under hasSrc. What I would suggest is running kirimase init again and making sure that if you are using a src folder, you select yes for the first question, otherwise no and it shouldn't show this issue anymore. Let me know.

peterarusanoff commented 1 year ago

Hey @nicoalbanese, Thanks I did not see run kirimase init in the read me , Funny enough when I do run it it gives me the same error.

Here is the list of the choices that I made, Although I have tried other variations and it still gives me the same error.

? Are you using a 'src' folder? Yes
? Please pick your preferred package manager PNPM
? Select an ORM to use: Prisma
? Please choose your DB type Postgres
? Select an authentication package to use: Auth.js (NextAuth)
? Select a provider to add google, github, apple

## After all installs are completed it crashes 

node:fs:601
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open 'src/app/layout.tsx'
    at Object.openSync (node:fs:601:3)
    at Object.readFileSync (node:fs:469:35)
    at addContextProviderToLayout (file:///Users/.nvm/versions/node/v18.16.1/lib/node_modules/kirimase/dist/commands/add/utils.js:17:28)
    at addNextAuth (file:///Users/.nvm/versions/node/v18.16.1/lib/node_modules/kirimase/dist/commands/add/auth/next-auth/index.js:67:5)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async addPackage (file:///Users/.nvm/versions/node/v18.16.1/lib/node_modules/kirimase/dist/commands/add/index.js:36:17) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'src/app/layout.tsx'
}
nicoalbanese commented 1 year ago

Thanks for the extra info. This is failing when it is trying to add the various providers to your root layout. Are you running this in a directory where you have a next.js project? Do you have a layout.tsx file? If so where?

Can you send a screenshot of the app directory?

peterarusanoff commented 1 year ago

Hey @nicoalbanese I am actually running this in an empty folder each time. When it fails I just delete everything and start again. My thought process is that this would build everything for me including tsc init and npm init. Can I recommend adding these 2 to the init process? This CLI tool came highly recommended! and I am excited to start using it.

nicoalbanese commented 1 year ago

Hey Peter - understood and thanks for the context. Kirimase is meant to be run after you have created a new nextjs app (with create-next-app). I will add some wording to the readme to clarify this point. Happy to hear it was recommended and hope it helps!

peterarusanoff commented 1 year ago

you might want to mention that doing tsc --init will crash the builder as it's not working well with JSON.parse Also I used create-next-app and it is still giving me the same error.

nicoalbanese commented 1 year ago

I'm not sure I follow with the usage of tsc. Could you describe each of the steps you are taking from the beginning?

zingerj commented 1 year ago

@peterarusanoff did you run create-next-app with the pages dir or app dir? If you have pages then I don't think Kirimase will work, right @nicoalbanese?

nicoalbanese commented 1 year ago

Hey @zingerj - that's correct, Kirimase only works with the App directory. I will add that to the readme!

smadikanti commented 1 year ago

I have both the app and pages directories in my project. However, based on our discussion, I'm still facing challenges. Can you assist me in resolving this issue? Thank you!

Screenshot 2023-10-23 at 7 22 05 PM
smadikanti commented 1 year ago

Managed to resolve this, thank you!

nicoalbanese commented 1 year ago

I have changed the init script to only run if app directory is identified to avoid this happening again. Cheers!