Skip to content

ern run-ios failing with mkdirp error #1891

Open
@fhkarczeski

Description

@fhkarczeski

Hello everyone,

Starting last Monday April 10 we noticed that existing apps can no longer run locally on iOS. Running the ern run-ios command gives this error:

✔ Booting iOS Simulator 0s
✖ Building iOS Runner project 36s
✖ An error occurred: iOS Runner build failed [xcbuild exit code 65].
✖ To troubleshoot this build failure, we recommend building the Runner iOS project from Xcode.
✖ You can open the Runner project in Xcode manually or by running 'open ios/ErnRunner.xcodeproj'.
✖ Building the Runner from Xcode will provide more meaningful error reporting that can be of help
✖ to pinpoint the cause of the build failure.

I tried to build the .xcworkspace on Xcode and I got this error:

/.ern/containergen/out/ios/node_modules/react-native/scripts/generate-specs-cli.js:47
  mkdirp.sync(outputDirectory);
         ^

TypeError: mkdirp.sync is not a function
    at generateSpec (/.ern/containergen/out/ios/node_modules/react-native/scripts/generate-specs-cli.js:47:10)
    at main (/.ern/containergen/out/ios/node_modules/react-native/scripts/generate-specs-cli.js:91:3)
    at Object.<anonymous> (/.ern/containergen/out/ios/node_modules/react-native/scripts/generate-specs-cli.js:94:1)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47
Command PhaseScriptExecution failed with a nonzero exit code

Looking at the generate-specs-cli.js file, I see that it is requiring mkdirp, this is the line requiring the library:
const mkdirp = require('mkdirp');

Looking into the mkdirp library it is loading, I see that it is exporting this:

export const mkdirp = Object.assign(async (path, opts) => {
    path = pathArg(path);
    const resolved = optsArg(opts);
    return useNative(resolved)
        ? mkdirpNative(path, resolved)
        : mkdirpManual(path, resolved);
}, {
    mkdirpSync,
    mkdirpNative,
    mkdirpNativeSync,
    mkdirpManual,
    mkdirpManualSync,
    sync: mkdirpSync,
    native: mkdirpNative,
    nativeSync: mkdirpNativeSync,
    manual: mkdirpManual,
    manualSync: mkdirpManualSync,
    useNative,
    useNativeSync,
});
//# sourceMappingURL=index.js.map

So the mkdirp object being imported is actually mkdirp.mkdirp.sync, I can fix it either by fixing the sync call or the require like const { mkdirp } = require('mkdirp');.
If I make either change above and rebuild it with Xcode, it runs the application correctly. But if I run the ern run-ios command again, it overrides the changes and breaks again. This miniapp was running correctly last Friday, April 7, and all of our miniapps stopped working on the following Monday. I haven't seen any change on Electrode that could've caused this error, and we haven't changed our apps either. This has happened to multiple devs, so it's does not seem like a local machine issue.

Does anyone have any ideas of what could be happening?
ern version: v0.50.1
miniapp react native version: 0.66.5
node: v16.17.0
npm: 8.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions