菜鸟教程小白 发表于 2022-12-13 16:05:42

ios - yarn 运行 ios - 错误 : Cannot find module - React Native


                                            <p><p>因此,我正在设置新的 <strong>React Native 项目</strong>,并且我正在尝试设置 XCode 模拟器。当我从项目文件夹运行“yarn run ios”时,我在 <strong>XCode</strong> 和终端中打开了我的 React Native 项目,我收到错误“<strong>错误:找不到模块'@ babel/runtime/helpers/interopRequireDefault'
    在 Function.Module._resolveFilename</strong>"。</p>

<p></p><div class="snippet"data-lang="js"data-hide="false"data-console="true"data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>    My-MacBook-Pro-2:projectZero alexs$ yarn run ios
yarn run v1.13.0
$ react-native run-ios
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module &#39;@babel/runtime/helpers/interopRequireDefault&#39;
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.&lt;anonymous&gt; (/Users/alexs/Desktop/React/Native/projectZero/node_modules/react-native/local-cli/cliEntry.js:11:41)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Module._compile (/Users/alexs/Desktop/React/Native/projectZero/node_modules/pirates/lib/index.js:83:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.newLoader (/Users/alexs/Desktop/React/Native/projectZero/node_modules/pirates/lib/index.js:88:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
error Command failed with exit code 1.
</code></pre>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我通过运行解决了它:</p>

<pre><code>yarn add @babel/runtime
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios -yarn 运行 ios - 错误 : Cannot find module - React Native,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/54492738/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/54492738/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - yarn 运行 ios - 错误 : Cannot find module - React Native