-
Notifications
You must be signed in to change notification settings - Fork 932
Description
Environment
| Name | Version |
|---|---|
| React Native | 0.81.0 |
| Node | v18.20.8 |
| Yarn | 3.6.4 |
| OS | macOS (sequoia 15.6.1), chip: Apple M1 |
Description
Current Behavior
After upgrading my React Native project from 0.72.4 to 0.81.0, the Metro packager fails to start when running the app.
It throws the following error immediately when executing the generated script:
/....../node_modules/.generated/launchPackager.command ; exit;
(node:62945) UnhandledPromiseRejectionWarning: 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> (/...../node_modules/@react-native-community/cli-clean/build/clean.js:67:39)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/......./node_modules/@react-native-community/cli-clean/build/index.js:7:37)
Additional warnings shown:
(node:62945) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.
Expected Behavior
Metro packager should start normally and the app should run as expected, without throwing unhandled promise rejection errors.
Steps To Reproduce
- Upgrade an existing project from [email protected] to [email protected].
- Install dependencies via npm install or yarn install.
- Try running the project via:
npx react-native start
npm run ios / android - Observe the crash output above.
What I’ve Tried
- Deleted node_modules, yarn.lock, and reinstalled.
- Cleared Metro and Watchman caches:
- npx react-native start --reset-cache
- watchman watch-del-all
- Verified Node version compatibility.
- Removed .generated folder and reinstalled CLI.
The error persists.
Possible Cause
The error originates from the @react-native-community/cli-clean package, likely due to an invalid promisify call around line 67 in clean.js:
const rimrafAsync = promisify(rimraf); // possibly rimraf is undefined
It seems rimraf may not be properly imported or the version mismatch (deprecated in v3 and replaced in newer Node versions) may cause it to resolve as undefined.