node.js - React Native 本地主机 SSL 证书无效

标签 node.js react-native ssl expo

我在几周前使用 Expo 启动了这个 React Native 项目,直到昨天一切都很好。

当我运行 expo start 时,我像往常一样得到 Metro Bundler,然后我点击“在网络浏览器中运行”,像往常一样,VS Code 终端提示我输入本地主机的密码证书的事。我不知道那是什么,但有 this link对于一些本地 SSL 签名工具,我也一无所知。即使有了链接,我也不确定我应该输入什么密码,所以我只是按了回车键而没有输入任何内容,这就是我现在的位置。

我无法再在浏览器中运行我的应用程序。每当我尝试这样做时,我都会得到:

halp

日志只有这个:

PS D:\Projects\GroceryApp\GroceryApp.Web> expo start

Starting project at D:\Projects\GroceryApp\GroceryApp.Web

Expo DevTools is running at http://localhost:19003

Opening DevTools in the browser... (press shift-d to disable)

Ensuring auto SSL certificate is created (you might need to re-run with sudo)

Starting Metro Bundler on port 19001.

debug Watch mode is not supported in this environment

debug Checking for a newer version of React Native

debug Current version: 0.61.4

debug No release cache found

debug No release cache found

debug Checking for newer releases on GitHub

debug No release cache found

debug Saving "6d6386b01438c6ef0acd213d304b5839" to cache

debug No release cache found

debug No release cache found

debug Latest release: 0.60.0

Tunnel ready.

exp://192.168.0.108:19000

QRCODE

To run the app with live reloading, choose one of:

• Sign in as @redacted in Expo client on Android or iOS. Your projects will automatically appear in the "Projects" tab.

• Scan the QR code above with the Expo app (Android) or the Camera app (iOS).

• Press a for Android emulator, or w to run on web.

• Press e to send a link to your phone with email.

Expo Press ? to show a list of all available commands.

Logs for your project will appear below. Press Ctrl+C to exit.

所以,我尝试通过按 W 来强制执行它,然后我得到了这个:

Attempting to open the project in a web browser...

(node:15116) UnhandledPromiseRejectionWarning: Error: The certificate "D:\Projects\GroceryApp\GroceryApp.Web.expo\web\development\ssl\cert-localhost.pem" is invalid.

error:2007E073:BIO routines:BIO_new_mem_buf:null parameter at validateKeyAndCerts (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\src\addons\withDevServer.ts:26:11) at getHttpsConfig (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\src\addons\withDevServer.ts:62:5) at createDevServer (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\src\addons\withDevServer.ts:191:12) at Object.withDevServer (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\src\addons\withDevServer.ts:101:31) at Object. (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\src\webpack.config.ts:419:21) at Generator.next () at C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\webpack\webpack.config.js:8:71
at new Promise () at __awaiter (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\webpack\webpack.config.js:4:12) at Object.default_1 [as default] (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\webpack\webpack.config.js:87:12) at C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\src\index.ts:21:71 at Generator.next () at C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\webpack\index.js:8:71 at new Promise () at __awaiter (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\webpack\index.js:4:12)
at createWebpackConfigAsync (C:\Users\Redacted\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\webpack\index.js:26:12)

(node:15116) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)

(node:15116) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

这是有道理的,因为那个文件完全是空的。

抱歉发了这么长的帖子,我想确保所有的日志都在这里。

请帮忙。提前致谢。

最佳答案

我建议升级到较新版本的 expo 并重新运行。

关于node.js - React Native 本地主机 SSL 证书无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61312282/

相关文章:

javascript - Nodejs Http Server api 执行流程请解释一下?

node.js - 将 MERN 应用程序部署到 Azure 中,一直使用 "localhost"在本地运行

javascript - React Native - 修改(添加)数据后图表不会正确重新呈现

react-native-router-flux - 在选项卡中重置导航堆栈

javascript - 父级的 setState 不会触发子级的 componentWillReceiveProps

php - 警告 : stream_socket_client(): unable to set private key file

javascript - 完全控制nodejs中使用ajax发送的文件

node.js - 使用express.js 和twitter 获取node.js 中的最后3 条推文。终端显示我的应用程序已通过身份验证但返回 null

asp.net-mvc - 对 Windows 服务和 ASP.NET MVC Web 应用程序使用相同的证书(在 IIS 中)

Java API 连接失败 : PKIX path