maidsafe-archive / safe_examples

examples showcasing various features of the SAFE Network
BSD 3-Clause "New" or "Revised" License
82 stars 50 forks source link

npm start fails in safe_app_electron_quick_start #405

Open rKinson opened 5 years ago

rKinson commented 5 years ago

I'm using Atom IDE and I have already worked through the Electron quick start tutorial without errors.

I'm at this point in the safe_app_electron_quick_start tutorial;

"At this point we have an Electron application ready to be launched, let's run it:

$ npm start

You should see a "Hello SAFE Network!" message in our app's window and an empty list of trips. We are now ready to start creating the code to be able to store the planned trips into the SAFE Network."

Terminal output is;

PS C:\Users\Admin\github\safe_examples\safe_app_electron_quick_start> npm start
> safe_app_electron_quick_start@1.0.1 start C:\Users\Admin\github\safe_examples\safe_app_electron_quick_start
> electron .
 
C:\Users\Admin\github\safe_examples\safe_app_electron_quick_start\main.js:57
app.on('ready', createWindow)
   ^
 
TypeError: Cannot read property 'on' of undefined
    at Object.<anonymous> (C:\Users\Admin\github\safe_examples\safe_app_electron_quick_start\main.js:57:4)
    at Object.<anonymous> (C:\Users\Admin\github\safe_examples\safe_app_electron_quick_start\main.js:83:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:167:16)
    at bootstrap_node.js:589:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! safe_app_electron_quick_start@1.0.1 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the safe_app_electron_quick_start@1.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2018-10-16T06_17_41_848Z-debug.log

Log output is;

PS C:\Users\Admin\AppData\Roaming\npm-cache\_logs> gc 2018-10-16T06_17_41_848Z-debug.log
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   'start' ]
2 info using npm@5.6.0
3 info using node@v8.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle safe_app_electron_quick_start@1.0.1~prestart: safe_app_electron_quick_start@1.0.1
6 info lifecycle safe_app_electron_quick_start@1.0.1~start: safe_app_electron_quick_start@1.0.1
7 verbose lifecycle safe_app_electron_quick_start@1.0.1~start: unsafe-perm in lifecycle true
8 verbose lifecycle safe_app_electron_quick_start@1.0.1~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_
modules\npm-lifecycle\node-gyp-bin;C:\Users\Admin\github\safe_examples\safe_app_electron_quick_start\node_modules\.
bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbe
m;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0_181\bin;C
:\Program Files\nodejs\;C:\Program Files\Calibre2\;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;C:\Users\Admi
n\AppData\Roaming\npm;C:\Users\Admin\Documents\NetBeansProjects\Shared\ANT\apache-ant-1.10.5\bin;C:\Users\Admin\Doc
uments\NetBeansProjects\Shared\GWT\gwt-2.8.2;
9 verbose lifecycle safe_app_electron_quick_start@1.0.1~start: CWD: C:\Users\Admin\github\safe_examples\safe_app_el
ectron_quick_start
10 silly lifecycle safe_app_electron_quick_start@1.0.1~start: Args: [ '/d /s /c', 'electron .' ]
11 silly lifecycle safe_app_electron_quick_start@1.0.1~start: Returned: code: 1  signal: null
12 info lifecycle safe_app_electron_quick_start@1.0.1~start: Failed to exec start script
13 verbose stack Error: safe_app_electron_quick_start@1.0.1 start: `electron .`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecyc
le\index.js:285:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecyc
le\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid safe_app_electron_quick_start@1.0.1
15 verbose cwd C:\Users\Admin\github\safe_examples\safe_app_electron_quick_start
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.j
s" "start"
18 verbose node v8.11.3
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error safe_app_electron_quick_start@1.0.1 start: `electron .`
22 error Exit status 1
23 error Failed at the safe_app_electron_quick_start@1.0.1 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
bochaco commented 5 years ago

Hi @rKinson , can you please confirm you are running all the steps from the shell console and not from an Atom addon? I just looked it up on the web and it seems that could cause problems with Electron. Can you please try removing the node_modules folder and doing npm i followed by npm start from a shell console?

hunterlester commented 5 years ago

I have already worked through the Electron quick start tutorial without errors. I'm at this point in the safe_app_electron_quick_start tutorial

You went through the tutorial once already with success? This second time around did you clone into a different directory or are you using the same directory? Verify that electron has been installed in your node_modules directory of the project. Next, I'd do something like place a log below this line to verify that electron module exists at run time.

Another possibility: Open Task Manager and look for electron processes that might be hanging. End those tasks if present.

rKinson commented 5 years ago

@bochaco @hunterlester hello :-) I have re-formatted my laptop today (not related to this - I just do every now and then) so I will try the tutorial again and let you know what happens with a brand new system.

bochaco commented 5 years ago

Ok @rKinson , if it works we can add that to the tutorial, "re-format your laptop" :D just kidding ofc!! :D Please make sure you run the npm commands from a shell console and not from any Atom addon/console