Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adamspotlite opened this issue Feb 1, 2024 · 23 comments
Open

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

adamspotlite opened this issue Feb 1, 2024 · 23 comments
Labels
blocked upstream problem is on an upstream package

Comments

@adamspotlite
Copy link

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

@adamspotlite adamspotlite changed the title bug: Unable to run pnpm dev in starter pack bug: Unable to run pnpm dev in expo due to .gitignore Feb 1, 2024
@parz1
Copy link

parz1 commented Feb 2, 2024

same issue here and don want to execute with sudo

@AMayer1997
Copy link

AMayer1997 commented Feb 2, 2024

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
Copy link
Member

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
Copy link

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
Copy link
Member

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
Copy link

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
Copy link

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
Copy link

Evanion commented Feb 16, 2024

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

@adamspotlite
Copy link
Author

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
Copy link

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
Copy link
Author

@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
Copy link
Author

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
Copy link
Member

juliusmarminge commented Mar 19, 2024

I opened an issue right after expo started generating gitignore that got converted to discussion (see expo/router#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
Copy link
Contributor

Happening to me as well

@swebreza
Copy link

swebreza commented May 25, 2024

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
Copy link

+1

@juliusmarminge juliusmarminge added blocked upstream problem is on an upstream package labels Jun 9, 2024
@CarlosZiegler
Copy link

Tested right now and have same issue :)

@recallwei
Copy link

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

@CarlosZiegler
Copy link

Then cli create new again

@swebreza
Copy link

try this
attrib -r .gitignore

@CarlosZiegler
Copy link

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

@ancill
Copy link

ancill commented Aug 15, 2024

Linux user here.
Solved by
cd apps/expo
chmod 777 .gitignore

@bdtren
Copy link

bdtren commented Aug 20, 2024

In my case, the .gitignore also cannot open in visual studio code.
So I did this and the issue gone:

  • Remove the not openable .gitignore
  • Create a new empty .gitignore file
  • Run npx expo start

btw, here is the common content of .gitignore, you can paste it to empty file:

# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
ios/
android/

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo

# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
# The following patterns were generated by expo-cli

expo-env.d.ts
# @end expo-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked upstream problem is on an upstream package
Projects
None yet
Development

No branches or pull requests