react-native-community / cli

The React Native Community CLI - command line tools to help you build RN apps
MIT License
2.34k stars 899 forks source link

Cannot build on real device #2474

Closed JackJBlundell closed 2 weeks ago

JackJBlundell commented 4 weeks ago

Environment

System: OS: macOS 14.4 CPU: (8) arm64 Apple M1 Memory: 180.66 MB / 8.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.11.1 path: ~/.nvm/versions/node/v20.11.1/bin/node Yarn: version: 3.6.4 path: /opt/homebrew/bin/yarn npm: version: 10.2.4 path: ~/.nvm/versions/node/v20.11.1/bin/npm Watchman: version: 2024.08.05.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /Users/jackblundell/.rvm/gems/ruby-2.7.4/bin/pod SDKs: iOS SDK: Platforms:

Description

When I try to run my React Native app on a real iOS device, I am faced with the following error:


Showing All Messages
TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function. Received undefined

    at promisify (internal/util.js:279:11)

    at Object.<anonymous> (/Users/jackblundell/Desktop/Testing/2.0/RouteBuddies/node_modules/@react-native-community/cli-clean/build/clean.js:67:39)
Screenshot 2024-08-15 at 20 18 16

It appears this is coming from:

const rmAsync = (0, _util().promisify)(_fs().rm);

Reproducible Demo

With my specifications, just creating an application with npx react-native init AppName --template react-native-template-typescript.

You must add this to your package.json in the scripts section:

    "build:ios": "react-native bundle --entry-file ./index.js --platform ios --bundle-output ios/main.jsbundle --assets-dest ios"
JackJBlundell commented 3 weeks ago

Could we get some help here please? We cannot deploy because of this package. Appreciate any input from maintainers at all to help identify where things might be going wrong on my local device. @jsierles @sharnik @benvinegar @alloy 🙏😄

szymonrybczak commented 3 weeks ago

hey @JackJBlundell, did you resolve your issue? For me running bundling command that you've provided works without any issues in new project:

❯ npx react-native bundle --entry-file ./index.js --platform ios --bundle-output ios/main.jsbundle --assets-dest ios
                Welcome to Metro v0.80.10
              Fast - Scalable - Integrated

info Writing bundle output to: ios/main.jsbundle
info Done writing bundle output
info Copying 6 asset files
info Done copying assets

What's your Node version? Please make sure that you're using right Node binary for the build (you can check this inside ios/.xcode.env.local file).