expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
755 stars 79 forks source link

Error on local build with very weird ENOTDIR #2173

Open cipriancaba opened 7 months ago

cipriancaba commented 7 months ago

Build/Submit details page URL

No response

Summary

local build fails

❯ EXPO_DEBUG=1 DEBUG=expo:* npx eas build --local --profile development-simulator --platform ios Error: ENOTDIR: not a directory, open '/Users/cipri/dev/pp/al/al/apps/al/ios/Pods/Headers/Private/FBLazyVector/FBLazyVector/FBLazyIterator.h/package.json'

Managed or bare?

managed

Environment

bunx expo-env-info

expo-env-info 1.0.5 environment info: System: OS: macOS 14.2.1 Shell: 5.9 - /bin/zsh Binaries: Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node Yarn: 1.19.0 - ~/.nvm/versions/node/v18.17.1/bin/yarn Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2 IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9477386 Xcode: 15.2/15C500b - /usr/bin/xcodebuild npmPackages: @expo/webpack-config: ^19.0.0 => 19.0.0 expo: ^50.0.0-preview.8 => 50.0.0-preview.8 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.73.1 => 0.73.1 npmGlobalPackages: eas-cli: 5.9.3 Expo Workflow: bare

❯ npx expo-doctor Error: ENOTDIR: not a directory, open '/Users/cipri/dev/pp/al/al/apps/al/ios/Pods/Headers/Private/FBLazyVector/FBLazyVector/FBLazyIterator.h/package.json'

Error output

Error: ENOTDIR: not a directory, open '/Users/cipri/dev/pp/al/al/apps/al/ios/Pods/Headers/Private/FBLazyVector/FBLazyVector/FBLazyIterator.h/package.json'

Reproducible demo or steps to reproduce from a blank project

happens in a monorepo

nohoist

"nohoist": [ "**/expo" ]

szdziedzic commented 7 months ago

What is your working dir when you run the eas build command?

cipriancaba commented 7 months ago

What is your working dir when you run the eas build command?

/Users/cipri/dev/pp/al/al/apps/al

Monorepo root: /Users/cipri/dev/pp/al/al

Not sure why eas would even want to access the /package.json from an h file?

I'm going crazy over this. bunx seems to work but not when trying to build locally, it hits the same error

EXPO_DEBUG=1 DEBUG=expo:* bunx eas build --local --profile development-simulator --platform ios
Loaded "env" configuration for the "development-simulator" profile: ANDROID_SDK_ROOT, ANDROID_HOME. Learn more: https://docs.expo.dev/build-reference/variables/
Specified value for "ios.bundleIdentifier" in app.config.ts or app.json is ignored because an ios directory was detected in the project.
EAS Build will use the value found in the native code.
ios.buildNumber field in app config is ignored when version source is set to remote, but this value will still be in the manifest available via expo-constants. It's recommended to remove this value from app config.
Unable to track Expo.plist in Git. Proceeding without tracking.
  Reason: the command "git add /Users/cipri/dev/pp/al/al/apps/al/ios/APP/Supporting/Expo.plist" exited with an error.

- Compressing project files
npm exited with non-zero code: 236
- Compressing project files
Error: npm exited with non-zero code: 236
    at ChildProcess.completionListener (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/node_modules/@expo/spawn-async/build/spawnAsync.js:41:23)
    at Object.onceWrapper (node:events:629:26)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
    ...
    at spawnAsync (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23)
    at isAtLeastNpm7Async (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/build/build/local.js:87:54)
    at getCommandAndArgsAsync (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/build/build/local.js:75:19)
    at runLocalBuildAsync (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/build/build/local.js:30:37)
    at /Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/build/build/build.js:84:50
    at startBuildAsync (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/build/build/runBuildAndSubmit.js:250:18)
    at async prepareAndStartBuildAsync (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/build/build/runBuildAndSubmit.js:236:19)
    at async runBuildAndSubmitAsync (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/build/build/runBuildAndSubmit.js:87:49)
    at async Build.runAsync (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/build/commands/build/index.js:41:9)
    at async Build._run (/Users/cipri/.nvm/versions/node/v20.9.0/lib/node_modules/eas-cli/node_modules/@oclif/core/lib/command.js:80:22) {
  pid: 3827,
  output: [
    '',
    "Error: ENOTDIR: not a directory, open '/Users/cipri/dev/pp/al/al/apps/al/ios/Pods/Headers/Private/FBLazyVector/FBLazyVector/FBLazyIterator.h/package.json'\n"
  ],
  stdout: '',
  stderr: "Error: ENOTDIR: not a directory, open '/Users/cipri/dev/pp/al/al/apps/al/ios/Pods/Headers/Private/FBLazyVector/FBLazyVector/FBLazyIterator.h/package.json'\n",
  status: 236,
  signal: null
}
- Compressing project files
    Error: build command failed.
- Compressing project files
ddnzcn commented 5 months ago

I can reproduce it within monorepo. Even the npx expo start command complains me about something inside the pods is not a directory

➜  expo git:(main) ✗ npx expo start
Error: ENOTDIR: not a directory, open '<monorepo_root>/apps/mobile_apps/expo/ios/Pods/Headers/Private/DoubleConversion/double-conversion/bignum-dtoa.h/package.json'
    at async open (node:internal/fs/promises:633:25)
    at async readFile (node:internal/fs/promises:1242:14)
    at async mapWorkspaces (/Users/ddnzcn/.nvm/versions/node/v21.6.2/lib/node_modules/npm/node_modules/@npmcli/map-workspaces/lib/index.js:109:15)
    at async Config.loadLocalPrefix (/Users/ddnzcn/.nvm/versions/node/v21.6.2/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js:707:28)
    at async Config.loadProjectConfig (/Users/ddnzcn/.nvm/versions/node/v21.6.2/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js:638:5)
    at async Config.load (/Users/ddnzcn/.nvm/versions/node/v21.6.2/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js:282:5)
    at async #load (/Users/ddnzcn/.nvm/versions/node/v21.6.2/lib/node_modules/npm/lib/npm.js:195:5)
    at async module.exports (/Users/ddnzcn/.nvm/versions/node/v21.6.2/lib/node_modules/npm/lib/cli-entry.js:40:5)

The .h file exists but I'm not so sure why it appends a /package.json after it.

ddnzcn commented 5 months ago

@cipriancaba I had success with upgrading to SDK 50.

cipriancaba commented 5 months ago

Thanks @ddnzcn Been on 50 but still happening, really weird. I can run it with bunx for now

ddnzcn commented 4 months ago

@cipriancaba I've recently reproduced the same error again while trying to open react-devtools. I suspect it's something related to nvm or npx. Are you also using nvm or something similar?

cipriancaba commented 4 months ago

Yeah, using nvm, only happens with this monorepo though

ddnzcn commented 4 months ago

I just tried to removed every other version that I had installed with nvm. It didn't worked. I'll investigate this a little further. Thank you for pointing me to bunx but even bunx still gives me the same error.

ddnzcn commented 4 months ago

It seems I have deleted .DS_Store file deleted in the local repository. Recloning the projected solved the issue for me.

sahinakkaya commented 4 months ago

The problem happens because you somehow include "ios" and "android" folders in your package.json.

My directory structure was like this:

apps
└── myApp
    ├── expo
    └── next

And there was ios and android folders under expo. In my package.json, I had:

  "workspaces": [
    "apps/**/*",
    ...
  ],

which will include expo and all of its subdir.

The problem is gone after I removed android and ios folders.

(Couldn't find a way to generate these folders outside expo dir. And also couldn't find a way to exclude them)

cipriancaba commented 3 months ago

Oh wow @sahinakkaya that's an interesting find. I tested that and it seems that expo now runs fine

Still think this shouldn't happen and it should be fixed by the expo team

Thanks for pointing me in the right direction

"workspaces": {
    "packages": [
      "apps/app",
      "apps/site"
    ]
sahinakkaya commented 3 months ago

I have encountered the same problem again. This time it was not ios or android folders. It was because I added a random script bump-android.sh inside expo dir. And the error was like can't find 'bump-android.sh/package.json' . This is really stupid but just make sure you don't have any file / folders other than the required ones in expo dir.