首页 > 其他分享 >mac 创建React Native项目遇到的问题

mac 创建React Native项目遇到的问题

时间:2024-05-07 16:38:33浏览次数:17  
标签:huang Pro ios bundle React mac install huangdeMacBook Native

React Native创建项目遇到的问题

1.创建项目时提示:

⠧ Processing templateUsage Error: The nearest package directory (/Users/huang/Documents/develop/RN/myRn) doesn't seem to be part of the project declared in /Users/huang.

- If /Users/huang isn't intended to be a project, remove any yarn.lock and/or package.json file there.

看提示是缺少yarn.lock文件,进到目录内创建一个yarn.lock

huang@huangdeMacBook-Pro RN % cd myRn                          
huang@huangdeMacBook-Pro myRn % touch yarn.lock   

2.创建项目时提示需要到ios目录执行 bundle install 、 bundle exec pod install 命令,执行 bundle install 后提示没有权限

huang@huangdeMacBook-Pro ios %  bundle install  
There was an error while trying to write to
`/Users/huang/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions.15001.tmp`.
It is likely that you need to grant write permissions for that path.

.bundle/设置读写权限后,再执行就成功了。

huang@huangdeMacBook-Pro ios % sudo chmod -R 777 /Users/huang/.bundle/
Password:
huang@huangdeMacBook-Pro ios % bundle install  
  1. bundle exec pod install 报错,是没有安装依赖引起的。
huang@huangdeMacBook-Pro ios % bundle exec pod install
[!] Invalid `Podfile` file: [!] /Users/huang/.nvm/versions/node/v20.12.0/bin/node -p require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  ) /Users/huang/Documents/develop/RN/myRn/ios

node:internal/modules/cjs/loader:1146
  throw err;
  ^

Error: Cannot find module 'react-native/scripts/react_native_pods.rb'
Require stack:
- /Users/huang/Documents/develop/RN/myRn/ios/[eval]
    at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
    at Function.resolve (node:internal/modules/helpers:190:19)
    at [eval]:1:9
    at runScriptInThisContext (node:internal/vm:209:10)
    at node:internal/process/execution:109:14
    at [eval]-wrapper:6:24
    at runScript (node:internal/process/execution:92:62)
    at evalScript (node:internal/process/execution:123:10)
    at node:internal/main/eval_string:51:3 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/huang/Documents/develop/RN/myRn/ios/[eval]' ]
}

返回项目主目录,执行 yarn install 安装按成后,再回到ios目录, 执行bundle exec pod install命令,就可以正常安装了

huang@huangdeMacBook-Pro myRn % cd ..
huang@huangdeMacBook-Pro myRn % yarn install

huang@huangdeMacBook-Pro myRn % cd ios
huang@huangdeMacBook-Pro ios % bundle exec pod install

标签:huang,Pro,ios,bundle,React,mac,install,huangdeMacBook,Native
From: https://www.cnblogs.com/huangczh/p/18177640

相关文章

  • [Unit testing - React] Use the waitForElementToBeRemoved Async Util to Await Unt
    Sometimes,youmightneedtowaitforanelementtodisappearfromyourUIbeforeproceedingwithyourtestsetupormakingyourassertion.Inthislesson,wewilllearnaboutawrapperaroundthewaitForthatallowsyoutowaituntilanelementisremove......
  • [Unit Testing - React] Use the Testing Playground to Help Decide Which Query to
    Queryingisdifficult!Evenifwefollowtheguidingprinciplesandalwaysstartfromthequeriesaccessibletoeveryone,weareboundtogetstucksometimes.Tohelpusout,theTestingPlaygroundwascreated.Inthislesson,wearegoingtoseehowtou......
  • Burp Suite Professional 2024.4 (macOS, Linux, Windows) - Web 应用安全、测试和扫
    BurpSuiteProfessional2024.4(macOS,Linux,Windows)-Web应用安全、测试和扫描BurpSuiteProfessional,Test,find,andexploitvulnerabilities.请访问原文链接:BurpSuiteProfessional2024.4(macOS,Linux,Windows)-Web应用安全、测试和扫描,查看最新版。原创......
  • Luminar Neo 1.19.0 (macOS Universal) - 创新 AI 图像编辑器
    LuminarNeo1.19.0(macOSUniversal)-创新AI图像编辑器利用尖端的人工智能生成技术,轻松增强照片效果请访问原文链接:LuminarNeo1.19.0(macOSUniversal)-创新AI图像编辑器,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org提升您的照片编辑能力。你想象......
  • Burp Suite Professional 2024.4 for macOS x64 & ARM64 - 领先的 Web 渗透测试软件
    BurpSuiteProfessional2024.4formacOSx64&ARM64-领先的Web渗透测试软件世界排名第一的Web渗透测试工具包请访问原文链接:BurpSuiteProfessional2024.4formacOSx64&ARM64-领先的Web渗透测试软件,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org......
  • 界面控件DevExtreme v23.1、v23.2盘点 - 增强的TypeScript(Angular、React、Vue)
    DevExtreme拥有高性能的HTML5/JavaScript小部件集合,使您可以利用现代Web开发堆栈(包括React,Angular,ASP.NETCore,jQuery,Knockout等)构建交互式的Web应用程序。从Angular和Reac,到ASP.NETCore或Vue,DevExtreme包含全面的高性能和响应式UI小部件集合,可在传统Web和下一代移动应用程序中......
  • Ubuntu18 安装NoMachine远程桌面(解决远程桌面延迟)
    #问题:Ubuntu18使用自带的共享桌面、VNC远程桌面延迟、降低分辨率也无效。#方案:最后找到安装NoMachine的远程桌面,解决远程卡顿问题根据自己操作系统选择NoMachineforLinux进行下载官网:https://downloads.nomachine.com/#出处:#https://www.cnblogs.com/liucx/#安装方......
  • react中事件冒泡导致弹窗关不掉
    代码如下<Modalactions={[{text:'Cancel',variant:'secondary',onClick:()=>setDeleteAutomatedReportModalVisible(false),},/>点击Cancel按钮,弹窗应该关闭才对,......
  • React入门
    React极简入门:从JavaScript到React-知乎(zhihu.com) HTML<!DOCTYPEhtml><html><head><metacharset="utf-8"><title>Mytestpage</title></head><body><h1>这是标题一</h1>......
  • 自研AP配置(MAC地址修改)
    自研AP配置(MAC地址修改)【概要】两种修改AP的MAC地址方法:1.修改AP的data文件夹中的MAC地址,在AP上电启动时,自动写入tmp文件夹2.每次上电修改tmp文件夹本文记录第一种修改方法【步骤】1.分别修改2.4G和5G的文件【mt7916.dbdc.b0.dat】、【mt7916.dbdc.b1.dat】中的MAC地址,末尾地址......