项目在Expo移动设备上运行,但在android模拟器上运行 所以我已经在命令下面运行
npm run eject
或
expo eject
它向我显示了以下错误,我尝试了所有可能的方法,甚至更新了 babel预设,react-native-scripts为2。 但这不起作用
> react-native run-android
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> (D:\rcf\AwesomeProject\node_modules\react-native\local
-cli\cliEntry.js:11:41)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module._compile (D:\rcf\AwesomeProject\node_modules\pirates\lib\index.js:
83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.newLoader [as .js] (D:\rcf\AwesomeProject\node_modules\pirates\lib
\index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:599:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ android script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
答案 0 :(得分:0)
尝试安装这两个依赖项:
npm install --save-dev @babel/core
npm install --save-dev @babel/runtime