遇到了一个让我陷入困境3个小时的问题。我开始学习Electron框架。
在我安装独立之前,一切都运转良好:ElectronViewRenderer。
这是错误:无法找到模块' ../ js / index.js'
我的文件夹结构:http://puu.sh/yAbnR/1acdb39aa7.png
我的Index.ejs(查看):
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link href="asset://../node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a id="home" class="navbar-brand" href="#">WebSiteName</a>
</div>
<ul class="nav navbar-nav">
<li class="active" id="home"><a href="#">Home</a></li>
<li id="page1"><a href="#">Page 1</a></li>
<li id="page2"><a href="#">Page 2</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li id="register"><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul>
</div>
</nav>
Test
<script>
require('../js/index.js');
window.$ = window.jQuery = require('jquery');
</script>
</body>
</html>
Packager.json:
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"Electron",
"quick",
"start",
"tutorial",
"demo"
],
"author": "GitHub",
"license": "CC0-1.0",
"devDependencies": {
"electron": "1.7.9"
},
"dependencies": {
"bootstrap": "^3.3.7",
"electron-view-renderer": "^1.2.4",
"jquery": "^3.2.1"
}
}
答案 0 :(得分:1)
您是否尝试索引index.js中的index.js文件?