如何解决React Native Android上的打包器错误

3

你好,我是一名新手,在Android上使用React Native。我正在做一个示例应用程序,参考了这篇文章:http://blog.couchbase.com/2015/november/getting-started-with-react-native-android-and-couchbase-lite。但在运行npm start时,出现了以下错误:

npm ERR! Linux 3.16.0-70-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.0.0
npm ERR! npm  v3.9.0
npm ERR! code ELIFECYCLE
npm ERR! react_sample@1.0.0 start: `node_modules/react-native/packager/packager.sh`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the react_sample@1.0.0 start script 'node_modules/react-native/packager/packager.sh'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the react_sample package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node_modules/react-native/packager/packager.sh
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs react_sample
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls react_sample
npm ERR! There is likely additional logging output above.

请问是packager.sh或者cli.js出了问题,导致我无法在Android上成功运行应用程序。我已经注册了npm,如果我运行应用程序构建,则会成功,但是index.android.js中的输出并不准确。请有经验的人帮忙解决这个问题。


这上面有没有其他的代码行?通常在这些行之上会有一个包安装失败的错误,可以帮助解决问题。 - BradByte
打包工具无法监听8081端口,这是端口问题吗?如何调试?@BradBumbalough - Ashwini Bhat
嘿,这个问题有解决方案吗? - Jickson
@jickson 还没有,请如果你有解决方案回复并点赞。 - Ashwini Bhat
1个回答

0

你很可能已经在其他地方运行了打包程序... 执行以下命令。

$ lsof -n -i4TCP:8081

你应该会得到一个进程 ID(PID)返回。使用返回的 ID 运行下一个命令。

$ kill -9 <PID>

现在再次尝试运行 npm start


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接