Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Could not determine react-native-codegen location" after upgrading to 0.65 #32035

Closed
canpoyrazoglu opened this issue Aug 18, 2021 · 14 comments
Closed
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.

Comments

@canpoyrazoglu
Copy link

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

After an upgrade from 0.64.x to 0.65 I get:

Error: Could not determine react-native-codegen location. Try running 'yarn install' or 'npm install' in your project root.
Command PhaseScriptExecution failed with a nonzero exit code.

I confirm this is the case after a complete purge of node_modules, yarn.lock, Pods, Podfile.lock, Xcode build folder, and a fresh install/build too.

React Native version:

System:
OS: macOS 11.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 27.26 GB / 64.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.2 - /usr/local/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.13 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
Android NDK: 17.2.4988734
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6858069
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: 10.0.2 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^17.0.2 => 17.0.2
react-native: ^0.65.0 => 0.65.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Have React Native 0.64.x project.
  2. Upgrade your dependencies to 0.65.
  3. Install/update via yarn and CocoaPods.
  4. Try to build.

Expected Results

Project should build normally.

@canpoyrazoglu
Copy link
Author

I've found out installing react-native-codegen as a dev dependency fixes the issue:

yarn add --dev react-native-codegen

But again, I think it should be subdependency of React Native and be installed by that instead of needing a manual install.

@lukebars
Copy link

@canpoyrazoglu it's mentioned inside the release notes that you should add react-native-codegen

@exneval
Copy link

exneval commented Aug 18, 2021

the changelog said react-native-codegen version 0.0.7 is now needed as a devDependency in the package.json.
and also in upgrade helper the patch put codegen in dev dependencies,
you sure this is not a setup issue?

@canpoyrazoglu
Copy link
Author

canpoyrazoglu commented Aug 18, 2021 via email

@exneval
Copy link

exneval commented Aug 18, 2021

it shouldn't be problem with clean RN 0.65,
but for upgrading, we need to patch it manually, because 0.64.2 template doesn't have the codegen installed before

@canpoyrazoglu
Copy link
Author

@exneval okay then I've thought it was required for everyone including clean install. My bad.

@liuhy412484577
Copy link

@exneval okay then I've thought it was required for everyone including clean install. My bad.

I also encountered this problem, may I ask your solution is?

@exneval
Copy link

exneval commented Sep 2, 2021

@liuhy412484577 if you are updating to 0.65.x please also install react-native-codegen as dev dependency

@liuhy412484577
Copy link

dev depende
Thank you for your reply! YES , updating to 0.65.x ,
is add react-native-codegen in devDependencies for root directory package.json ?

@canpoyrazoglu
Copy link
Author

yarn add react-native-codegen -D

@buschco
Copy link

buschco commented Apr 17, 2022

If your react-native app lives inside a monorepo, you might want to nohoist it:

// root package.json

  "workspaces": {
    "packages": [
      "packages/*"
    ],
    "nohoist": [
      "**/react-native",
      "**/react-native/**",
      // other rn deps
      "**/react-native-codegen"
    ]
  },

@nica0012
Copy link

I've been trying to build my project for just about a week now. I've upgraded to 0.65 and after installing react-native-codegen I am getting this error now:

Showing Recent Messages

cp: /tmp/react-native-codegen-ACuCqgfd/out/FBReactNativeSpec.h: No such file or directory
cp: /tmp/react-native-codegen-ACuCqgfd/out/FBReactNativeSpec-generated.mm: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

I'm stumped on this, out of my 5 years using react native this has been my biggest headache.

@milobob
Copy link

milobob commented Aug 7, 2022

I've been trying to build my project for just about a week now. I've upgraded to 0.65 and after installing react-native-codegen I am getting this error now:

Showing Recent Messages

cp: /tmp/react-native-codegen-ACuCqgfd/out/FBReactNativeSpec.h: No such file or directory
cp: /tmp/react-native-codegen-ACuCqgfd/out/FBReactNativeSpec-generated.mm: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

I'm stumped on this, out of my 5 years using react native this has been my biggest headache.

I have the exact same issue... it's a very mysterious one, which came after I installed eslint for the Atom IDE. So I had to install some npm packages, and in the process uninstalled react-native-codegen. After re-installing react-native-codegen it's all messed up. I worry I might have overwritten some XCode IDE setting. I have tried removing node modules, pods, reinstalling the project, etc, etc. I'm thinking re-installing Xcode to try to fix it (last resort) is getting closer now that nothing seems to be working to solve the problem.

Did you solve the issue?

@milobob
Copy link

milobob commented Aug 7, 2022

OMG. Ok it was react-native-codegen. I was using version 0.0.7 and when I upgraded to a newer one, it caused the error. I installed old version using 'npm install react-native-codegen@0.0.7 -save-dev' and that fixed the problem. Hopefully you don't lose another 5 years on this issue!!

@facebook facebook locked as resolved and limited conversation to collaborators Aug 18, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants