t3-oss / create-t3-turbo

Clean and simple starter repo using the T3 Stack along with Expo React Native
https://turbo.t3.gg
MIT License
4.36k stars 364 forks source link

bug: Unable to run `pnpm dev` in expo due to `.gitignore` #873

Open adamspotlite opened 5 months ago

adamspotlite commented 5 months ago

Provide environment information


  System:
    OS: Linux 6.5 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900HK
    Memory: 44.39 GB / 62.47 GB
    Container: Yes
    Shell: 3.3.1 - /usr/bin/fish
  Binaries:
    Node: 21.6.0 - ~/.local/share/nvm/v21.6.0/bin/node
    npm: 10.2.4 - ~/.local/share/nvm/v21.6.0/bin/npm
    pnpm: 8.11.0 - ~/.local/share/pnpm/pnpm

Describe the bug

Upon downloading the template, I'm unable to run pnpm dev in apps/expo. I receive the following permissions error due to the .gitignore:

Starting Metro Bundler
Error: EACCES: permission denied, open '/home/learning-projects/t3-test/apps/expo/.gitignore'
    at Object.readFileSync (node:fs:456:20)
    at Object.upsertGitIgnoreContents (/home/learning-projects/t3-test/node_modules/@expo/cli/src/utils/mergeGitIgnorePaths.ts:121:30)
    at Object.startTypescriptTypeGenerationAsync (/home/learning-projects/t3-test/node_modules/@expo/cli/src/start/server/type-generation/startTypescriptTypeGeneration.ts:51:85)

Link to reproduction

https://github.com/t3-oss/create-t3-turbo

To reproduce

npx create-turbo@latest -e https://github.com/t3-oss/create-t3-turbo

cd repo_name

pnpm i

cd apps/expo

pnpm dev

Additional information

No response

parz1 commented 5 months ago

same issue here and don want to execute with sudo

AMayer1997 commented 5 months ago

Hi, I had the same issue. It looks like the .gitignore file gets generated without any rwx permissions. I fixed the issue by deleting the file and creating an empty /apps/expo/.gitignore file. The file should get updated automatically once you run pnpm dev again.

juliusmarminge commented 5 months ago

Can you please verify that this doesnt happen on a normal expo app? I dont see why this would be a cause of t3 turbo so this issue should likely be opened upstream?

AMayer1997 commented 5 months ago

It works for me with a normal expo app. An intact .gitignore file gets generated with the cli: npx create-expo-app my-app.

btw thanks for your open source contributions

juliusmarminge commented 5 months ago

It works for me with a normal expo app. An intact .gitignore file gets generated with the cli: npx create-expo-app my-app.

btw thanks for your open source contributions

And if you delete that file and run pnpm dev again? I'm guessing that the create-expo cli is copyinh some template file at init with proper permisssions but then the dev server writes with different ones?

AMayer1997 commented 5 months ago

I deleted the .gitignore file and it does not get generated again. I used npm run ios instead of pnpm dev, because the default expo app comes with npm.

IanWorley commented 5 months ago

I want to report I have the same issue and I fix the issue by adding file permissions to the .gitignore and running pnpm run dev

Evanion commented 5 months ago

I can confirm that this is not a unique T3 issue, I get the same in an NX monorepo

adamspotlite commented 5 months ago

Does anyone know where to put this then? I feel like the proper steps are:

1) Close this issue 2) Make a note somewhere that there is a solution to the solution (namely, running chmod 644 apps/expo/.gitignore) 3) Add a new issue in one of the expo-cli repos

psycho-baller commented 4 months ago

Is there anything wrong with just manually adding a .gitignore file to the expo directory as @AMayer1997 mentioned here

Hi, I had the same issue. It looks like the .gitignore file gets generated without any rwx permissions. I fixed the issue by deleting the file and creating an empty /apps/expo/.gitignore file. The file should get updated automatically once you run pnpm dev again.

adamspotlite commented 4 months ago

@psycho-baller not that I can tell - I think that's likely what most folks end up doing (myself included), without any downstream implications.

adamspotlite commented 4 months ago

Does anyone know where to put this then? I feel like the proper steps are:

  1. Close this issue
  2. Make a note somewhere that there is a solution to the solution (namely, running chmod 644 apps/expo/.gitignore)
  3. Add a new issue in one of the expo-cli repos

@juliusmarminge should i go through with this? I don't think this needs to be an active issue, but I feel it should be documented for future reference.

juliusmarminge commented 4 months ago

I opened an issue right after expo started generating gitignore that got converted to discussion (see https://github.com/expo/router/discussions/846)

I bumped that to see if they want a new issue or not. Either way I think we can keep this issue open just for visibility until they have fixed it on there part.

dBianchii commented 2 months ago

Happening to me as well

swebreza commented 2 months ago

OS : Windows 11

go to apps/expo/ and run following command. I will suggest 2nd one because it worked for me.

1) icacls .gitignore /grant %username%:F or 2) attrib -r .gitignore

recallwei commented 1 month ago

+1

CarlosZiegler commented 1 month ago

Tested right now and have same issue :)

recallwei commented 1 month ago

Try to delete the .gitignore file generated by Expo, then rerun.

CarlosZiegler commented 1 month ago

Then cli create new again

swebreza commented 1 month ago

try this attrib -r .gitignore

CarlosZiegler commented 1 month ago

Works if use sudo, but this is not a solution :(