纱线运行ios-错误:找不到模块-React Native

时间:2019-02-02 11:43:49

标签: ios xcode react-native reactive-programming simulator

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

    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 '@babel/runtime/helpers/interopRequireDefault'
    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.<anonymous> (/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 [as .js] (/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.
 

有人知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:3)

我通过运行解决了该问题:

yarn add @babel/runtime