No such file error when using yarn workspaces

I recently started to try and eject my app that is currently in a yarn workspace. I went through the installation instructions for react-native-unimodules. My pod install command worked fine after updating the node_module location like is suggested: use_unimodules!(modules_paths: [‘…/…/node_modules’]).

I am running into an issue building the app from xcode with the following error:

../node_modules/expo-updates/scripts/ No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

I believe this is because the node_modules are not actually in that location and should be up another level because of yarn workspaces. I am going to try and use the no-hoist option for yarn workspaces
but would really prefer not to do that. Has anyone ran into this?

you need to update the path that it points to in the build phases of your project if it’s not in the parent directory node_modules

1 Like

@notbrent Thanks for pointing me in the right direction there, I didn’t know where that config lived! That at least got me past that error and I can debug the next one separately.

1 Like

Hi @tilthsift ! Did you also use expo-yarn-workspaces? I also face this kind of issue thanks to you & @notbrent, now I’m able to do the pod install. But I keep running into this metro error:

Error: Error loading assets JSON from Metro. Ensure you've followed all expo-updates installation steps correctly. The "directory" argument must be of type string. Received type undefined
    at /path/to/node_modules/expo-updates/scripts/createManifest.js:27:11 

I already added hashAssetFiles per suggested while ejecting, here’s my current metro.config.js

// eslint-disable-next-line
const { createMetroConfiguration } = require('expo-yarn-workspaces');
// eslint-disable-next-line
const { getDefaultConfig } = require('@expo/metro-config');

module.exports = (() => {
  const {
    resolver: { assetExts, ...otherResolver },
  } = createMetroConfiguration(__dirname);
  const defaultConfig = getDefaultConfig(__dirname);

  return {
    transformer: {
      babelTransformerPath: require.resolve('react-native-svg-transformer'),
      minifierConfig: {
        keep_classnames: true,
        keep_fnames: true,
        mangle: {
          keep_classnames: true,
          keep_fnames: true,
        output: {
          ascii_only: true,
          quote_style: 3,
          wrap_iife: true,
        sourceMap: {
          includeSources: false,
        toplevel: false,
        compress: {
          reduce_funcs: false,
      assetPlugins: ['expo-asset/tools/hashAssetFiles'],
    resolver: {
      assetExts: [...assetExts, ...defaultConfig.resolver.assetExts].filter(
        (ext) => ext !== 'svg',
      sourceExts: ['svg', ...defaultConfig.resolver.sourceExts],

Here’s the expo diagnostics

  Expo CLI 4.1.6 environment info:
      OS: macOS 11.2.1
      Shell: 5.8 - /bin/zsh
      Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.13.4 - ~/.nvm/versions/node/v12.14.1/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
      CocoaPods: 1.10.1 - /usr/local/bin/pod
      iOS SDK:
        Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
      Android Studio: 4.1 AI-201.8743.12.41.6953283
      Xcode: 12.4/12D4e - /usr/bin/xcodebuild
      expo: 40.0.1 => 40.0.1
      react-dom: 16.13.1 => 16.13.1
      react-native: ~0.63.4 => 0.63.4
      react-native-web: 0.13.18 => 0.13.18
      expo-cli: 4.1.6
    Expo Workflow: bare

Did you also run into this error?

did you add the postinstall script to your project? expo/ at master · expo/expo · GitHub

Hey @notbrent! Yes, we have that in our scripts
Turns out, this was because index.js not being generated :cry:. It seems that the way expo-yarn-workspaces handles app entry point conflicts with how expo-updates handle it. Able to resolve this by creating index.js manually at the moment. Here’s the link to the issue / quick solve: App crash in Android after update using expo-updates in bare RN project · Issue #9429 · expo/expo · GitHub

Quick question: is it expected to manually defined node_modules path while using expo-yarn-workspaces ? Or I’ve been using expo-yarn-workspaces the wrong way in bare workflow?
If it’s expected to manually defined the node_modules path, do we still need to use expo-yarn-workspaces in bare workflow?

Thank you in advance!