1
Command `pod install` failed. 
 └─ Cause: Invalid `Podfile` file: cannot load such file -- ./scripts/autolinking.

 #  from /Users/developer/Documents/Project1/ios/Podfile:1
-------------------------------------------
 >  require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")  
 #  require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")  
-------------------------------------------

sh: node: command not found

I've been trying to figure this out all day and still can't figure out what the issue is. I've got node in my paths so it can find the command.

I figured out if I were to change the first require line to File.join('node_modules/expo/scripts/autolinking') it manages to execute, however then it throws the same issue for a file within the node modules, which i can't go through and change all the node_modules manually.

Does anyone know why this is happening?

YaBCK
  • 2,949
  • 4
  • 32
  • 61

1 Answers1

0

On Mac M1 Install CocoaPod from HomeBrew to your terminal in the project folder or globally Delete existing Podfile if any . If none, good dont worry

run pod init

This will create a new Podfile

Then in ios folder run pod install or npx pod-install

if you get errors below, you probably have wrong .env

ERROR: SyntaxError: JSON Parse error: Unexpected identifier "undefined"
ERROR: Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.`

Hope this helps :)