admin管理员组文章数量:1025206
I want to post the version of my app but instead I got this weird error. Does someone see what's wrong, because I can't see it. (Node.js is included)
error: Unexpected token <
<script>
console.log(process);
let output =
<h2 class="page-header">App version Data</h2>
<ul class="list-group">
<li class="list-group-item">Node: ${process.versions.node}</li>
</ul>
document.getElementById('output').innerHTML = output;
</script>
I want to post the version of my app but instead I got this weird error. Does someone see what's wrong, because I can't see it. (Node.js is included)
error: Unexpected token <
<script>
console.log(process);
let output =
<h2 class="page-header">App version Data</h2>
<ul class="list-group">
<li class="list-group-item">Node: ${process.versions.node}</li>
</ul>
document.getElementById('output').innerHTML = output;
</script>
Share
Improve this question
edited Apr 9, 2019 at 11:33
Stijn van Woerkom
asked Apr 8, 2019 at 9:58
Stijn van WoerkomStijn van Woerkom
352 silver badges12 bronze badges
2
- 1 Right now you are showing your node version instead of app version – Mayank Vadiya Commented Apr 8, 2019 at 13:16
-
Are you missing backticks, I'm not seeing where the string starts/ends? Also, what is the
-->
doing in the code? – snwflk Commented Apr 8, 2019 at 17:25
2 Answers
Reset to default 2On your client-side Javascript, you could require remote
to obtain the version of your application:
var appVersion = require("electron").remote.app.getVersion();
remote (https://electronjs/docs/api/remote)
Use main process modules from the renderer process.
Example of how I'm using it to determine app version.
process.versions.node
is only available in Nodejs. Here you are trying to get the version number from a client side JavaScript(I assume..) which will not work.
You could expose a nodeJs api and write a Get request to get the vetsion in front end.
The electron have the following API for getting the app version, which gets the version from package.json. https://electronjs/docs/api/app#appgetversion
I want to post the version of my app but instead I got this weird error. Does someone see what's wrong, because I can't see it. (Node.js is included)
error: Unexpected token <
<script>
console.log(process);
let output =
<h2 class="page-header">App version Data</h2>
<ul class="list-group">
<li class="list-group-item">Node: ${process.versions.node}</li>
</ul>
document.getElementById('output').innerHTML = output;
</script>
I want to post the version of my app but instead I got this weird error. Does someone see what's wrong, because I can't see it. (Node.js is included)
error: Unexpected token <
<script>
console.log(process);
let output =
<h2 class="page-header">App version Data</h2>
<ul class="list-group">
<li class="list-group-item">Node: ${process.versions.node}</li>
</ul>
document.getElementById('output').innerHTML = output;
</script>
Share
Improve this question
edited Apr 9, 2019 at 11:33
Stijn van Woerkom
asked Apr 8, 2019 at 9:58
Stijn van WoerkomStijn van Woerkom
352 silver badges12 bronze badges
2
- 1 Right now you are showing your node version instead of app version – Mayank Vadiya Commented Apr 8, 2019 at 13:16
-
Are you missing backticks, I'm not seeing where the string starts/ends? Also, what is the
-->
doing in the code? – snwflk Commented Apr 8, 2019 at 17:25
2 Answers
Reset to default 2On your client-side Javascript, you could require remote
to obtain the version of your application:
var appVersion = require("electron").remote.app.getVersion();
remote (https://electronjs/docs/api/remote)
Use main process modules from the renderer process.
Example of how I'm using it to determine app version.
process.versions.node
is only available in Nodejs. Here you are trying to get the version number from a client side JavaScript(I assume..) which will not work.
You could expose a nodeJs api and write a Get request to get the vetsion in front end.
The electron have the following API for getting the app version, which gets the version from package.json. https://electronjs/docs/api/app#appgetversion
本文标签: javascriptHow do I post App version with JS electronStack Overflow
版权声明:本文标题:javascript - How do I post App version with JS electron - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745615214a2159247.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论