szwacz / electron-boilerplate Goto Github PK
View Code? Open in Web Editor NEWBoilerplate application for Electron runtime
License: MIT License
Boilerplate application for Electron runtime
License: MIT License
first off, thank you for making this amazing boilerplate! really big help for starters like me on electron.
anyway, my question is, do you have plans on putting livereload feature in this boilerplate?
I was trying to integrate electron-connect (https://github.com/Quramy/electron-connect), but as a newbie, i am having a hard time putting it all together.
Thanks!
After checking out the project and had installded the NSIS of version 3.0b2 , I got the error when npm run release
Error: Can't change target charset after data already got compressed or header already changed!
Error in script "C:\workspace\git\electron-boilerplate\tmp\installer.nsi" on line 39 -- aborting creation process
Hi! I have created an app that replicates a database's tables to json files. I want to release this app as an executable. The problem is that after the script is compiled, I can't create the files. All the app files are inside the "app" folder. What should I do?
I have an application that creates a cluster [fork] and sends a message to it. The app works fine for development
build on Windows and Ubuntu. I then create a release (npm run release
) and things change. If I run the application from the Windows start menu or doubl-click the file in Explorer the program runs but the cluster terminates immediately after going online
with an exit code of 1. If I run the same application again but from the command line it works without a problem--the cluster does not terminate. The same thing happens in Ubuntu--fails from dash, works from the terminal.
I wasn't sure if you may have seen this or it is a symptom of the release process. If not I can post something to the electron github. As always, thanks for your time and any support.
I have this config.js file:
var config = {}; config.twitter = {}; config.redis = {}; config.web = {}; config.default_stuff = ['red','green','blue','apple','yellow','orange','politics']; config.twitter.user_name = process.env.TWITTER_USER || 'username'; config.twitter.password= process.env.TWITTER_PASSWORD || 'password'; config.redis.uri = process.env.DUOSTACK_DB_REDIS; config.redis.host = 'hostname'; config.redis.port = 6379; config.web.port = process.env.WEB_PORT || 9980; module.exports = config;
The file is located inside the app folder. I am trying to include it like this inside my app.js file:
var config = require('./config');
But I keep getting this error:
Uncaught Error: Cannot find module './config'
What am I doing wrong?
It's considered a bad idea to use RMDir /r $INSTIR
as you did on line 153. Imagine what would happen, when a user (accidentally?) installs into Program Files
. See this StackOverflow post and consider using these macros.
I'm a Electron and web tech beginner, and found this project very helpful as a starter kit. The app I'm developing can save and load a config file from disk. This has to be done from the main process, so I set up an IPC system.
Only the render process has access to requirejs as far as I can tell. If the main process would have access as well, it could be transpiled through Babel and use new ES6 features. It would also allow sharing code between the processes easier.
I currently have all main process code separated into app/main/
, which is excluded from transpilation.
Related to #22
I'm trying to expose a module imported in app.js:
import * as asInterface from './fontend/lib/asInterface';
in my app.html i have:
requirejs(['app'], function(app) {
window.app = app;
});
however app here is undefined, i imagine because app.js doesn't have a return value.
How do I modify the gulp task or project so that I can export an es6 module i've written to the global namespace?
The preload
option is not working due to the build script:
mainWindow = new BrowserWindow({
// ... other options
preload: path.join(__dirname, '/myPreloadedScript.js')
The built version (found under /build
folder) is wrapped inside define(['exports'], function (exports) {
leading to the following error:
ReferenceError: define is not defined
at Object.<anonymous> (C:\electronApp\build\myPreloadedScript.js:1:63)
at Module._compile (module.js:430:26)
at Object.Module._extensions..js (module.js:448:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\electronApp\node_modules\electron-prebuilt\dist\resources\atom.asar\renderer\lib\init.js:94:7)
at Object.<anonymous> (C:\electronApp\electronApp\node_modules\electron-prebuilt\dist\resources\atom.asar\renderer\lib\init.js:106:4)
at Module._compile (module.js:430:26)(anonymous function) @ C:\electronApp\electronApp\node_modules\electron-prebuilt\dist\resources\atom.asar\renderer\lib\init.js:101
Preloaded js file should not be transpiled.
One PR will follow
I followed your quick start instructions and I'm hitting an error after I run npm start
on OSX
I'm running node v0.12.4.
$ npm start
> @ start /Users/vinny/Projects/Personal/electron-boilerplate
> node ./tasks/start
[21:05:53] Using gulpfile ~/Projects/Personal/electron-boilerplate/gulpfile.js
[21:05:53] Starting 'clean'...
[21:05:53] Finished 'clean' after 3.66 ms
[21:05:53] Starting 'transpile'...
[21:05:53] Starting 'less'...
[21:05:53] Starting 'copy'...
[21:05:53] Starting 'finalize'...
[21:05:53] Finished 'finalize' after 2.72 ms
[21:05:53] Finished 'less' after 87 ms
[21:05:53] Finished 'transpile' after 122 ms
[21:05:53] Finished 'copy' after 239 ms
[21:05:53] Starting 'build'...
[21:05:53] Finished 'build' after 11 μs
/Users/vinny/Projects/Personal/electron-boilerplate/app/vendor/electron_boilerplate/window_state.js:12
var userDataDir = jetpack.cwd(app.getPath('userData'));
^
TypeError: app.getPath is not a function
at module.exports (/Users/vinny/Projects/Personal/electron-boilerplate/app/vendor/electron_boilerplate/window_state.js:12:39)
at Object.<anonymous> (/Users/vinny/Projects/Personal/electron-boilerplate/app/main.js:12:23)
at Module._compile (module.js:418:26)
at Object.Module._extensions..js (module.js:436:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:298:12)
at Module.require (module.js:353:17)
at require (module.js:372:17)
at Object.<anonymous> (/Users/vinny/Projects/Personal/electron-boilerplate/node_modules/electron-prebuilt/dist/Electron.app/Contents/Resources/atom.asar/browser/api/lib/dialog.js:11:9)
at Object.<anonymous> (/Users/vinny/Projects/Personal/electron-boilerplate/node_modules/electron-prebuilt/dist/Electron.app/Contents/Resources/atom.asar/browser/api/lib/dialog.js:153:4)
[21:05:54] Using gulpfile ~/Projects/Personal/electron-boilerplate/gulpfile.js
[21:05:54] Starting 'watch'...
[21:05:54] Finished 'watch' after 114 ms
Here's the output from the npm install
:
$ npm install
npm WARN package.json @ No repository field.
npm WARN package.json @ No license field.
npm WARN peerDependencies The peer dependency stream-browserify@* included from bl will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
\
> [email protected] install /Users/vinny/Projects/Personal/electron-boilerplate/node_modules/appdmg/node_modules/fs-xattr
> node-gyp rebuild
CXX(target) Release/obj.target/xattr/src/xattr.o
SOLINK_MODULE(target) Release/xattr.node
> [email protected] postinstall /Users/vinny/Projects/Personal/electron-boilerplate/node_modules/electron-prebuilt
> node install.js
|
> [email protected] install /Users/vinny/Projects/Personal/electron-boilerplate/node_modules/appdmg/node_modules/ds-store/node_modules/macos-alias
> node-gyp rebuild
CXX(target) Release/obj.target/volume/src/volume.o
SOLINK_MODULE(target) Release/volume.node
> @ postinstall /Users/vinny/Projects/Personal/electron-boilerplate
> node ./tasks/app_npm_install
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No license field.
[email protected] node_modules/fs-jetpack
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])
[email protected] node_modules/rcedit
[email protected] node_modules/q
[email protected] node_modules/yargs
[email protected] node_modules/asar
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected]
└── [email protected] ([email protected])
[email protected] node_modules/gulp-util
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected])
[email protected] node_modules/fs-jetpack
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])
[email protected] node_modules/vinyl-map
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected])
[email protected] node_modules/gulp
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] node_modules/esperanto
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected])
[email protected] node_modules/gulp-less
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] node_modules/electron-prebuilt
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
[email protected] node_modules/appdmg
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected])
Hi, I am trying to build a windows app using this boilerplate, but I get some trouble in installing dependencies. Errors shows below:
plrth_000@PLRTHINK-PC ~/Desktop/electron-boilerplate (master)
$ npm install
npm WARN package.json @ No repository field.
npm WARN optional dep failed, continuing [email protected]
/
> [email protected] postinstall c:\Users\plrth_000\Desktop\electron-boile
rplate\node_modules\electron-prebuilt
> node install.js
/
> @ postinstall c:\Users\plrth_000\Desktop\electron-boilerplate
> node ./tasks/app_npm_install
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1011:11)
at Process.ChildProcess._handle.onexit (child_process.js:802:34)
npm ERR! @ postinstall: `node ./tasks/app_npm_install`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the @ postinstall script.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./tasks/app_npm_install
npm ERR! You can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd c:\Users\plrth_000\Desktop\electron-boilerplate
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! c:\Users\plrth_000\Desktop\electron-boilerplate\npm-debug.log
npm ERR! not ok code 0
I am running nodev0.10.36 on windows8.1.
I have a separate js file to control the menu of my app. Inside the app folder, the file is fine, but when I run npm start, the file in the build folder has a random "define(function () {" added to it, which causes an error and for the file to be ignored. Is this a bug, or am I doing something wrong?
Another alternative to setting the environment variable npm_config_arch
to ia32
on 64-bit Windows is to have 32-bit Node.js (and npm) installed.
This is what I do since it's easy to switch between versions of Node.js and different architectures using nvm-windows.
(Related but off-topic note: If you use nvm-windows, I recommend running npm cache clear
before switching to a different version/arch of Node.js)
I installed jquery and semantic-ui to my project by adding the following dependencies into app/package.json:
"jquery": "1.11.3",
"semantic-ui": "2.1"
When I do npm start
, I see the following:
[22:43:53] Using gulpfile ~/Documents/analyzerii/gulpfile.js
[22:43:54] Starting 'clean'...
[22:43:54] Finished 'clean' after 4.43 ms
[22:43:54] Starting 'bundle'...
[22:43:54] Starting 'less'...
[22:43:54] Starting 'copy'...
[22:43:54] Starting 'finalize'...
[22:43:54] Finished 'finalize' after 11 ms
[22:43:54] Finished 'bundle' after 105 ms
[22:43:54] Finished 'less' after 136 ms
[22:44:39] Finished 'copy' after 45 s
[22:44:39] Starting 'build'...
[22:44:39] Finished 'build' after 14 μs
Why is "copy" taking 45s? Also, assuming this is just copying some files, why does it take so much of my cpu time and spin up my fans?
I'm just trying run this project on Windows 10 - 64bits, Node 5.0.0.
The npm install
command is OK, but when I run npm start
, I'm getting this error:
[20:20:38] Using gulpfile ~\Documents\electron-boilerplate\gulpfile.js
[20:20:38] Starting 'clean'...
[20:20:38] Finished 'clean' after 4.74 ms
[20:20:38] Starting 'bundle'...
[20:20:38] Starting 'less'...
[20:20:38] Starting 'copy'...
[20:20:38] Starting 'finalize'...
[20:20:38] Finished 'finalize' after 2.03 ms
{ [SyntaxError: Bad character escape sequence (1:42) in C:\Users\user\Documents\electron-boilerplate\app\background.js]
pos: 42,
loc: Position { line: 1, column: 42 },
raisedAt: 42,
code: 'PARSE_ERROR',
file: 'C:\\Users\\user\\Documents\\electron-boilerplate\\app\\background.js' }
{ [SyntaxError: Bad character escape sequence (1:42) in C:\Users\user\Documents\electron-boilerplate\app\app.js]
pos: 42,
loc: Position { line: 1, column: 42 },
raisedAt: 42,
code: 'PARSE_ERROR',
file: 'C:\\Users\\user\\Documents\\electron-boilerplate\\app\\app.js' }
[20:20:38] Finished 'less' after 92 ms
[20:20:39] Finished 'copy' after 377 ms
[20:20:40] Using gulpfile ~\Documents\electron-boilerplate\gulpfile.js
[20:20:40] Starting 'watch'...
[20:20:40] Finished 'watch' after 430 ms
Im getting the below error while running npm start:
C:\Users\arun\Documents\GitHub\electron-boilerplate>npm start
> @ start C:\Users\arun\Documents\GitHub\electron-boilerplate
> node ./tasks/start
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open 'C:\Users\arun\Documents\GitHub\electron-boilerplate\node_modules\electron-prebuilt\path.txt'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.<anonymous> (C:\Users\arun\Documents\GitHub\electron-boilerplate\node_modules\electron-prebuilt\index.js:4:21)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\arun\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v4.1.1
npm ERR! npm v2.11.0
npm ERR! code ELIFECYCLE
npm ERR! @ start: `node ./tasks/start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script 'node ./tasks/start'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./tasks/start
npm ERR! You can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\arun\Documents\GitHub\electron-boilerplate\npm-debug.log
Try these steps to reproduce this issue:
npm install
at the root of the reponpm start
to start the electron app/app/hello_world/hello_universe.js
and savetranspile-watch
task$ [12:37:26] Starting 'transpile-watch'...
[12:37:26] Finished 'transpile-watch' after 47 ms
Testing this with the latest commit as of now on a Mac, with node and npm versions as below:
$ node -v
v0.12.4
$ npm -v
2.11.3
It would be great if a sample built-in code for Windows Notifications is provided.
Also I have a doubt. Does electron support Windows 7 notification ?
Is there anything special I need to know in order to create 32-bit builds using this project?
First, thanks so much for the great bolilerplate, it has been great for a newbie of web programming to begin creating a cross platfore app with Electron.
I am working to add AngularJS and jQuery EasyUI support to the boilerplate. For easyui support I was able to add without any special requirejs problems or dependencies--later I need to refactor that to also use requirejs. However, I am adding AngularJS has brought about some questions with requirejs and I was hoping you could offer some suggestions.
I am now adding a requirejs.config statement to the boilerplate in the hopes of defining the correct requirejs layout/configuration for my app. Where would you envision this going? I have changed the boilerplate a bit in an attempt to getting just the requirejs dependencies working but I find some files get parsed but the define/function is not executed.
<!doctype html>
<html>
<head>
<title>Electron Boilerplate</title>
</head>
<body >
<h1>Hello World!</h1>
<script data-main="require_config" src="vendor/require.js"></script>
</body>
</html>
console.log("REQUIRE_CONFIG.JS-------------"+requirejs.version);
requirejs.config({
paths: {
'myapp': './js/myapp'
},
// kick start application
deps: ['./bootstrap']
});
console.log("BOOTSTRAP.JS1-------------");
define( ['myapp'], function (myapp) {
'use strict';
console.log("BOOTSTRAP.JS2+++++++++++++");
});
console.log("MYAPP.JS-------------");
define([], function () {
'use strict';
console.log("MYAPP.JS+++++++++++++");
});
NOTE: My modified code doesn't use your original app.js. I am only trying to test/target requirejs.
After running this example I find:
[1262:0917/172739:ERROR:browser_main_loop.cc(173)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
[1291:0917/172739:INFO:renderer_main.cc(200)] Renderer process started
[1295:0917/172739:INFO:renderer_main.cc(200)] Renderer process started
[1262:0917/172740:INFO:CONSOLE(4)] "REQUIRE_CONFIG.JS-------------2.1.20", source: file:///home/swdev/projects/build/require_config.js (4)
[1262:0917/172740:INFO:CONSOLE(4)] "BOOTSTRAP.JS1-------------", source: file:///home/swdev/projects/build/bootstrap.js (4)
The require_config.js and bootstrap.js are processed but the define/function is not executed. Furthermore, the app,js is not parsed at all. I have also removed the myapp dependency within bootloader.js to be define( [], function () {
but this didn't work either.
Could the problem here be related to requirejs or something other interaction with node.js/babel/etc? Any ideas or suggestions on what the problem might be and/or how you envision extending the requirejs infrastructure here would be much appreciated. Thanks in advanced for the time.
I've been trying to build on your repo to develop my own understanding of TDD when making an Electron App (your repo is the best integrated solution I've found)
I'm wondering if you could explain how you picture the requirejs()
function working in the index.html
. I was under the impression that requirejs helped managed loading all javascripts, however app.html
still includes <script src= ...>
tags. Also app.js (which is loaded by require) also includes module loading therein.
Is the intention for app.js to act as a central javascript file where all modules (either ES6 module pattern or commonJS pattern) are loaded that will be used by the webpage. It would be helpful to understand the javascript module loading pattern intended
I'm consistently seeing ERROR:ipc_channel_win.cc(138)] pipe error: 109
when I close the app on Windows.
Running Node v0.12.5 on Windows 8.1.
C:\Projects\ebp [master]> npm start
> @ start C:\Projects\ebp
> node ./tasks/start
[22:16:44] Using gulpfile C:\Projects\ebp\gulpfile.js
[22:16:44] Starting 'clean'...
[22:16:44] Finished 'clean' after 51 ms
[22:16:44] Starting 'transpile'...
[22:16:44] Starting 'less'...
[22:16:44] Starting 'copy'...
[22:16:44] Starting 'finalize'...
[22:16:44] Finished 'finalize' after 5.53 ms
[22:16:45] Finished 'less' after 102 ms
[22:16:45] Finished 'transpile' after 154 ms
[22:16:45] Finished 'copy' after 547 ms
[22:16:45] Starting 'build'...
[22:16:45] Finished 'build' after 16 μs
[11080:0628/221646:INFO:renderer_main.cc(200)] Renderer process started
[7468:0628/221646:INFO:renderer_main.cc(200)] Renderer process started
[22:16:46] Using gulpfile C:\Projects\ebp\gulpfile.js
[22:16:46] Starting 'watch'...
[22:16:47] Finished 'watch' after 487 ms
[[11080:0628/221705:ERROR:ipc_channel_win.cc(138)] pipe error: 109
7468:0628/221705:ERROR:ipc_channel_win.cc(138)] pipe error: 109
C:\Projects\ebp [master]>
Currently the NSIS doesn't do well with Hungarian characters. Even after creating the script file for the NSIS the character encoding is great, but in the installer and later in the path the characters are messed up.
For example:
Terület számolás
should be Terület számolás
I've found this little NSIS addon: http://nsis.sourceforge.net/Utf8Converter but I haven't got the faintest on how start using it... any help would be welcome 😄
Any chance you could add Babel support for those of us who want to use ES6 within the Application?
I not found the version of Jasmine used in this project, what is ?
Hi Jakub,
Thanks for this project, as I have been struggling with somewhat official electron-starter. This boilerplate worked so great and set up was a breeze. I have couple of questions.
electron-starter
. I think they build the electron
itself to customize the menu icons,... Any tradeoff I need to be aware of.electron
doc mentions they have asar
for that. Can you incorporate that in your release pipeline? or atleast minify the source files.default_app.js
with these menus configured but not sure a way to specify in my app.Thanks again for your effort. I was a lifesaver :-)
Cheers.
bsr
Hi, thanks for the awesome template for me to kickstart electron development!
I have a question that why do you use two package.json, one for development, one for distribution, as package.json already has devDependencies for us to declare development dependencies?
Thanks :)
When I run npm run release
on my Windows, I got the following error message.
E:\code\nodejs\electron-boilerplate>npm run release
> @ release E:\code\nodejs\electron-boilerplate
> gulp release --env=production
[10:49:29] Using gulpfile E:\code\nodejs\electron-boilerplate\gulpfile.js
[10:49:29] Starting 'clean'...
[10:49:30] Finished 'clean' after 141 ms
[10:49:30] Starting 'transpile'...
[10:49:30] Starting 'less'...
[10:49:30] Starting 'copy'...
[10:49:30] Starting 'finalize'...
[10:49:30] Finished 'finalize' after 23 ms
[10:49:30] Finished 'less' after 186 ms
[10:49:30] Finished 'transpile' after 299 ms
[10:49:31] Finished 'copy' after 1.24 s
[10:49:31] Starting 'build'...
[10:49:31] Finished 'build' after 14 µs
[10:49:31] Starting 'release'...
[10:49:37] Building installer with NSIS...
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn makensis ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "release"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! @ release: `gulp release --env=production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ release script 'gulp release --env=production'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp release --env=production
npm ERR! You can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! E:\code\nodejs\electron-boilerplate\npm-debug.log
E:\code\nodejs\electron-boilerplate>
The content of E:\code\nodejs\electron-boilerplate\npm-debug.log
is belows
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'release' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prerelease', 'release', 'postrelease' ]
5 info prerelease @
6 info release @
7 verbose unsafe-perm in lifecycle true
8 info @ Failed to exec release script
9 verbose stack Error: @ release: `gulp release --env=production`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid @
11 verbose cwd E:\code\nodejs\electron-boilerplate
12 error Windows_NT 6.3.9600
13 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "release"
14 error node v0.12.4
15 error npm v2.10.1
16 error code ELIFECYCLE
17 error @ release: `gulp release --env=production`
17 error Exit status 1
18 error Failed at the @ release script 'gulp release --env=production'.
18 error This is most likely a problem with the package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error gulp release --env=production
18 error You can get their info via:
18 error npm owner ls
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
My OS is Win8.1 x64, and node/npm version is
E:\code\nodejs\electron-boilerplate>node -v
v0.12.4
E:\code\nodejs\electron-boilerplate>npm -v
2.10.1
E:\code\nodejs\electron-boilerplate>
The first time for the electron API app object (render-side), the second time for the requirejs module (browser-side).
I didn't understand the difference at first, but after reading the excellent Electron api docs this became clear. I would suggest renaming the app.js file to something like: mymodule.js or something?
When running npm run release
(os x 10.10.5) i get [Error: Cannot find module 'appdmg'] code: 'MODULE_NOT_FOUND' }
The built app runs fine though.
Curious what this errors means.
Versions:
npm: 2.10.1
electron: 0.33.0
would be nice to add a .bowerrc file, setting the working dir to app:
{
"cwd" : "app"
}
I had a situation where I could properly run the application from the terminal and double click the app in the nautilus window. However, launching from the Ubuntu Unity would give me a failure. After some looking it seems the app.desktop
needs the following:
Path=/opt/{{name}}/
If you'd prefer I could fork and use a pull request. Seemed like a simple change so I didn't do the fork, etc.
On Windows 7, when I make for distribution installer with command: npm run release
, I got error.
Failed at the @ release script 'gulp release --env=production
Here the contain of npm-debug.log
file
0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Applications\\nodejs\\\\node.exe',
1 verbose cli 'D:\\Applications\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'release' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prerelease', 'release', 'postrelease' ]
5 info prerelease @
6 info release @
7 verbose unsafe-perm in lifecycle true
8 info @ Failed to exec release script
9 verbose stack Error: @ release: `gulp release --env=production`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (D:\Applications\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (D:\Applications\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid @
11 verbose cwd C:\Users\lemoussel\SkyDrive\Electron\electron-boilerplate
12 error Windows_NT 6.1.7601
13 error argv "D:\\Applications\\nodejs\\\\node.exe" "D:\\Applications\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "release"
14 error node v0.12.7
15 error npm v2.11.3
16 error code ELIFECYCLE
17 error @ release: `gulp release --env=production`
17 error Exit status 1
18 error Failed at the @ release script 'gulp release --env=production'.
18 error This is most likely a problem with the package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error gulp release --env=production
18 error You can get their info via:
18 error npm owner ls
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
I want to create a file electron-boilerplate/app/anyfolder/constants.js
with content
module.exports = {
a = 1,
b = 2
}
Then use this file in main.js
as follows:
var constants = require('./anyfolder/constants');
However I get
Uncaught Exception:
ReferenceError: define is not defined
error because in build directory constant.js
's content is changed and starts with
define(['exports'], function (exports) {
What am I missing? Can't I use folders for javascripts to be used from main.js
?
Hi there,
Thanks so much for this very helpful boilerplate.
I have got my project set up, and it works just fine when I using "npm start".
When I create a windows install file via "npm run release", my app builds but when I open it, I get an error that my kinect2 module can not be found.
I am trying to require the kinect2 module, which has native bindings. I tried to run npm run app-install -- kinect2
but got a node-gyp error on compilation. The kinect2 lib has it's own install script, which I ran inside the boilerplate directory, and it runs fine in test mode.
Hopefully, I'm just missing something silly and it's not being copied over.
Thanks!
I have a situation where I have added a directory (./app/sdk/...). Under this sdk
directory I have Linux shared objects and Windows DLL's. I also have added "./sdk/**"
to the ./tasks/build.js
paths.copyFromAppDir
. When I run under Linux I have no problems: files are copied and the app opens fine. However, if I change to Windows I get gulp errors and files do not copy:
[13:44:28] 'watch' errored after 649 ms
[13:44:28] Error: EPERM: operation not permitted, scandir 'Z:\work\tmp\hmi\app\sdk\linux\libanlzr.so.orig'
at Error (native)
at Object.fs.readdirSync (fs.js:813:18)
at Glob._readdir (Z:\work\tmp\hmi\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\node_modules\globule\node_modules\glob\glob.js:577:20)
at Glob._process (Z:\work\tmp\hmi\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\node_modules\globule\node_modules\glob\glob.js:379:15)
at Glob.<anonymous> (Z:\work\tmp\hmi\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\node_modules\globule\node_modules\glob\glob.js:403:14)
at Array.forEach (native)
at Glob.<anonymous> (Z:\work\tmp\hmi\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\node_modules\globule\node_modules\glob\glob.js:402:9)
at Glob._readdir (Z:\work\tmp\hmi\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\node_modules\globule\node_modules\glob\glob.js:554:32)
at Glob._process (Z:\work\tmp\hmi\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\node_modules\globule\node_modules\glob\glob.js:379:15)
at Glob.<anonymous> (Z:\work\tmp\hmi\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\node_modules\globule\node_modules\glob\glob.js:403:14)
It seems the copy process fails to copy most of the files even though I don't see any other errors reported.
Also, just prior to the error being displayed I get a dialog box:
Error Opening App
"The app provided is not a valid...."
Error: Cannot find module: './vendor/electron_boilerplate/env_config'
If I remove the sdk
directory all together, the problem goes away. Also, if I only remove the sdk/linux
directory so no Linux shared libraries are found, the problem goes away.
Is there something else I need to configure so these offending files are not watched or copied? How can I get Windows to ignore the Linux directory? (or any directory for that matter). Thanks for the time and any suggestions.
Do I need separate project for Mac and Windows?
I am running virtual windows on Mac. I did following on MAC:
git clone https://github.com/szwacz/electron-boilerplate.git
cd electron-boilerplate
npm install
npm start
everything is fine. Can run, release.
The same application is not running from windows (i am using same project that i used to run from mac). Then I prepare another project for windows and it is running fine.
So, now i have 2 separate projects. one for MAC and another for Windows. Is it really required? Isn't it possible to release both platform build (Mac and Windows) from single project (that i am executing from MAC).
I installed Node 4.2.1 and NSIS on Windows 10.
After npm install
went through without errors, npm start
produces the following output:
Z:\>npm start
> @ start Z:\
> node ./tasks/start
[13:10:54] Using gulpfile Z:\gulpfile.js
module.js:339
throw err;
^
Error: Cannot find module 'Z:node_modules\gulp\index.js'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Liftoff.handleArguments (Z:\node_modules\gulp\bin\gulp.js:119:18)
at Liftoff.<anonymous> (Z:\node_modules\gulp\node_modules\liftoff\index.js:192:16)
at module.exports (Z:\node_modules\gulp\node_modules\liftoff\node_modules\flagged-respawn\index.js:17:3)
at Liftoff.<anonymous> (Z:\node_modules\gulp\node_modules\liftoff\index.js:185:9)
at Z:\node_modules\gulp\node_modules\liftoff\index.js:159:9
at Z:\node_modules\gulp\node_modules\v8flags\index.js:99:14
[13:10:58] Using gulpfile Z:\gulpfile.js
module.js:339
throw err;
^
Error: Cannot find module 'Z:node_modules\gulp\index.js'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Liftoff.handleArguments (Z:\node_modules\gulp\bin\gulp.js:119:18)
at Liftoff.<anonymous> (Z:\node_modules\gulp\node_modules\liftoff\index.js:192:16)
at module.exports (Z:\node_modules\gulp\node_modules\liftoff\node_modules\flagged-respawn\index.js:17:3)
at Liftoff.<anonymous> (Z:\node_modules\gulp\node_modules\liftoff\index.js:185:9)
at Z:\node_modules\gulp\node_modules\liftoff\index.js:159:9
at Z:\node_modules\gulp\node_modules\v8flags\index.js:99:14
First, thank you for the great boilerplate. It makes it easy to get the right start with electron.
I wonder wich Path I have to set for a Windows Release. I installed NSIS and seted the System Environment like that
setx PATH "%PATH%;C:/Program Files (x86)/NSIS"
but like that I get the following error:
[13:06:28] Building installer with NSIS...
C:\Users\robert\Desktop\electron-boilerplate\tasks\release_windows.js:101
+ " added to PATH environment variable?";
^
Can't find NSIS. Are you sure you've installed it and added to PATH environment
variable?
npm ERR! Windows_NT 6.1.7601
Maybe you got a hint how the set the System Environment Variable correctly?
Thank you very much.
Hi again :).
Could send the link of which has been downloaded the Jasmine version used ?
No version I tested, installed via bower or downloaded from Github worked.
This would rather speed up the contribution to the project.
How can I change the icon of the electron application?
in both files:
var ipc = require('ipc');
in main.js:
ipc.on('foo-foo', function () {
console.log("Foo!");
});
in dev_helper.js:
label: 'File',
accelerator: 'CmdOrCtrl+N',
click: function () {
ipc.send('foo-foo');
}
I get this error:
ipc.send is not a function..
Am I missing something?
I have created an electron boilerplate app and I'm loading the CSS inside the page itself using
link rel="stylesheet" type="text/css" href="assets/css/style.css"
But it takes 1-2 seconds for the CSS to load. Can I preload the CSS somehow? Or create a preloader, I don't know... but the white flash looks really bad.
Hi! I am trying to add my own custom CSS and JS files. I know I can edit main.less and app.js, but I want to keep them as separate files. How can I do that?
I have tried to add new folders or even add new files to existing folders, but nothing works.
I have read the documentation, but I can't find the information which refers to that. Or I did not understand, because I'm not an English native. I don't know. So, please help!
Later edit: Please close or delete this issue. I've found the answer at #62
Hey first of all this is a great boilerplate, I really appreciate the work you put into the different release processes, this makes everything much much simpler.
My current problem is I am not sure what is the best way to work React into this boilerplate. It seems that no matter what I do that it will error on any JSX code despite whether or not I load require("babel-core/register");
in any file. Is there an easy way to add this to your gulp file or is there some other way I can get this working.
Ideally I would be able to do import { HelloWorldComponent } from './hello_world/hello_world.js'
where hello_world is a React component. Any thoughts on how to make this happen?
Hello;
I'm new to electron and boilerplate. Earlier i was using nw.js to prepare desktop app of cordova based project. I am using browser platform as source to prepare desktop app.
I downloaded electron-boilerplate project and run it successfully on my mac. Now everytime I build / change my project files, i have to copy this files to electron-boilerplate directory and then have to run it. Is there any shortcut to do so? What is the best way to prepare build of my project? please note that my source directory is different then electron-boilerplate directory. I am using electron-boilerplate to prepare desktop apps build only.
i installed everything as per the documentation on OSX 10.8 and get up to the npm start
point, which exits after starting watch
:
.../electron-boilerplate ► npm start
> @ start .../electron-boilerplate
> node ./tasks/start
[17:18:49] Using gulpfile .../electron-boilerplate/gulpfile.js
[17:18:49] Starting 'clean'...
[17:18:49] Finished 'clean' after 43 ms
[17:18:49] Starting 'transpile'...
[17:18:49] Starting 'less'...
[17:18:49] Starting 'copy'...
[17:18:49] Starting 'finalize'...
[17:18:49] Finished 'finalize' after 3.17 ms
[17:18:50] Finished 'less' after 143 ms
[17:18:50] Finished 'transpile' after 217 ms
[17:18:50] Finished 'copy' after 412 ms
[17:18:50] Starting 'build'...
[17:18:50] Finished 'build' after 12 μs
[17:18:51] Using gulpfile .../electron-boilerplate/gulpfile.js
[17:18:51] Starting 'watch'...
.../electron-boilerplate ►
No application window is opened, and no error message is shown.
On a fresh install of the electron-boilerplate using npm 2.10.1, apart from the expected warnings I get the following:
npm WARN peerDependencies The peer dependency stream-browserify@* included from bl will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
Might be worth adding explicit dependencies sooner rather than later?
I just had one of those "something deep down in there is broken" errors.
All I was seeing was:
TypeError: _this10.module.locals.lookup(...).mark is not a function
but I don't know in what context that is.
tasks/build.js could be more helpful here:
}).catch(function(err) {
console.error('build: Error during rollup', err.stack);
});
That tells us where to look for what went wrong.
Then after I updated rollup I got a much nicer report:
Error during rollup [Error: Module /Users/crucial/code/idmx/models-of-self-organization/app/segregation/app.js does not export run (imported by /Users/crucial/code/idmx/models-of-self-organization/app/app.js)] Error: Module /Users/crucial/code/idmx/models-of-self-organization/app/segregation/app.js does not export run (imported by /Users/crucial/code/idmx/models-of-self-organization/app/app.js)
at Module.trace (/Users/crucial/code/idmx/models-of-self-organization/node_modules/rollup/dist/rollup.js:6711:28)
at /Users/crucial/code/idmx/models-of-self-organization/node_modules/rollup/dist/rollup.js:6358:81
at Array.forEach (native)
at /Users/crucial/code/idmx/models-of-self-organization/node_modules/rollup/dist/rollup.js:6357:25
at Array.forEach (native)
at Module.bindReferences (/Users/crucial/code/idmx/models-of-self-organization/node_modules/rollup/dist/rollup.js:6350:19)
at /Users/crucial/code/idmx/models-of-self-organization/node_modules/rollup/dist/rollup.js:7468:19
at Array.forEach (native)
at /Users/crucial/code/idmx/models-of-self-organization/node_modules/rollup/dist/rollup.js:7467:19
at tryCatch (/Users/crucial/code/idmx/models-of-self-organization/node_modules/rollup/dist/rollup.js:337:12)
and I know exactly what I screwed up.
Thanks for the boilerplate !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.