错误:无法加载捆绑本地主机:8081

ika*_*ita 8 reactjs react-native

我在运行react-native run-ios时遇到一个问题,以下消息显示,并且我认为它与babel有关:

反应本机包错误

有人已经有这个问题了吗?

"GET /index.bundle?platform=ios&dev=true&minify=false HTTP/1.error: bundling failed: Error: Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `/Volumes/SD/react/PropertyFinder/index.js`: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map
Run Code Online (Sandbox Code Playgroud)

谢谢

Div*_*nki 7

我有同样的问题。我尝试安装

npm添加@ babel / runtime

然后

npm安装

它对我有用,希望对您有所帮助。


msa*_*dak 6

有时,不同的程序使用相同的端口,例如80,8080或8081,当我遇到此问题时,我将默认端口设置为8088。

尝试

react-native run-ios --port=8088

如果更改端口不起作用,请尝试此操作。这会将@ babel / runtime软件包安装到您的项目中。

npm add @babel/runtime

npm install

之后,重新编译您的项目。

我希望它能起作用。


小智 5

有效的解决方案:

rm -rf ios/build/; kill $(lsof -t -i:8081)
Run Code Online (Sandbox Code Playgroud)

  • 请解释您的解决方案及其工作原理,以便其他人能够理解。 (5认同)