我正在遵循Electron 快速入门指南,它可以正常工作,没有任何错误,但输出与文档中的描述不同,document.write输出中不会显示带有的版本。
这是我的输出:
Hello World!
We are using node , Chrome , and Electron .
Run Code Online (Sandbox Code Playgroud)
我的预期输出将包括相应的版本号。
我检查了应用程序的 GitHub 页面,仍然相同,尝试了各种 StackOverflow 答案,但没有一个对我有用。
索引.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node) </script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron) </script>.
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
包.json
{
"name": "electronapp",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"author": "harsh",
"license": "ISC",
"devDependencies": {
"electron": "^5.0.2"
}
}
Run Code Online (Sandbox Code Playgroud)
主文件
{ …Run Code Online (Sandbox Code Playgroud)