首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Podfile安装失败-找不到节点模块

Podfile安装失败-找不到节点模块
EN

Stack Overflow用户
提问于 2022-03-18 12:59:54
回答 1查看 397关注 0票数 1
代码语言:javascript
运行
复制
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。

有人知道为什么会这样吗?

EN

回答 1

Stack Overflow用户

发布于 2022-11-21 11:48:26

在Mac M1上,将CocoaPod从HomeBrew安装到项目文件夹中的终端,或者全局删除现有的Podfile。如果没有,好的别担心

运行pod init

这将创建一个新的Podfile

然后在ios文件夹中运行pod installnpx pod-install

如果在下面出现错误,则可能是.env错误。

代码语言:javascript
运行
复制
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 :)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71527415

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档