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
我一整天都在努力弄清楚这件事,但还是弄不清楚是什么问题。我的路径中有node
,所以它可以找到命令。
我想,如果我将第一个require行更改为File.join('node_modules/expo/scripts/autolinking')
,它将设法执行,但是它会对节点模块中的一个文件抛出相同的问题,我无法通过这个问题手动更改所有node_modules。
有人知道为什么会这样吗?
发布于 2022-11-21 11:48:26
在Mac M1上,将CocoaPod从HomeBrew安装到项目文件夹中的终端,或者全局删除现有的Podfile。如果没有,好的别担心
运行pod init
这将创建一个新的Podfile
然后在ios文件夹中运行pod install
或npx pod-install
如果在下面出现错误,则可能是.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 :)
https://stackoverflow.com/questions/71527415
复制相似问题