asticode / go-astilectron-demo

Discover the power of Astilectron through a demo app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find module main.js

weiyixuan opened this issue · comments

I compile the application on Windows 10, that was successful.

$ ./output/windows-amd64/Astilectron\ demo.exe -v
2018/11/08 13:24:25 astilog: syslog is not implemented on this os, using stdout instead
{"level":"debug","msg":"Running app built at 2018-11-08 13:22:55.3468729 +0800 CST m=+3.828430301","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Skipping restoring resources...","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Starting...","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Provisioning...","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Astilectron has already been provisioned to version 0.29.0, moving on...","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Electron has already been provisioned to version 1.8.1, moving on...","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Listening...","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Executing...","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Starting cmd C:\\Users\\Caleb\\AppData\\Roaming\\Astilectron demo\\vendor\\electron-windows-amd64\\electron.exe C:\\Users\\Caleb\\AppData\\Roaming\\Astilectron demo\\vendor\\astilectron\\main.js 127.0.0.1:2234 false","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"Stdout says: \r","time":"2018-11-08T13:24:25+08:00"}
{"level":"debug","msg":"App has crashed","time":"2018-11-08T13:24:27+08:00"}
{"level":"debug","msg":"Stopping...","time":"2018-11-08T13:24:27+08:00"}
{"level":"debug","msg":"Closing...","time":"2018-11-08T13:24:27+08:00"}
{"level":"error","msg":"accept tcp 127.0.0.1:2234: use of closed network connection while TCP accepting","time":"2018-11-08T13:24:27+08:00"}
{"level":"debug","msg":"Stopping...","time":"2018-11-08T13:24:27+08:00"}
{"level":"fatal","msg":"running bootstrap failed: creating window failed: canceller.cancelled","time":"2018-11-08T13:24:27+08:00"}

Result (Error Message Box):

Error launching app
Unable to find Electron app at C:\Users\Caleb\AppData\Roaming\Astilectron demo\vendor\astilectron\main.js
Cannot find module 'C:\Users\Caleb\AppData\Roaming\Astilectron demo\vendor\astilectron\main.js'

@weiyixuan mmmm this is weird. Can you do 2 things:

  • tell me what files are in C:\Users\Caleb\AppData\Roaming\Astilectron demo\vendor\astilectron and if they are files with content (size > 0)?
  • remove the folder C:\Users\Caleb\AppData\Roaming\Astilectron demo and try again?

Let me know how it goes.

  1. nothing in C:\Users\Caleb\AppData\Roaming\Astilectron demo\vendor\astilectron
  2. remove the folder, the same result.

When I restore $GOPATH/src/github.com/asticode/go-astilectron to a commit number(576c111b093ac9b4641bbb23d0b2e122e0736179), it is normal.

@weiyixuan could you paste the logs when bundling your app with the -v flag? (i.e. astilectron-bundler -v) ?

@weiyixuan did you manage to fix your issue?

$ astilectron-bundler.exe -v
{"app_name":"","level":"debug","msg":"Creating C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\output","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Bundling for environment windows/amd64","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Binding data","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Removing C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\bind","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Creating C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\bind","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Creating C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\bind\\vendor_astilectron_bundler","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Creating C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\cache","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\cache\\astilectron-0.27.0.zip already exists, skipping download of https://github.com/asticode/astilectron/archive/v0.27.0.zip","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Copying C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\cache\\astilectron-0.27.0.zip to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\bind\\vendor_astilectron_bundler\\astilectron.zip","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\cache\\electron-windows-amd64-1.8.1.zip already exists, skipping download of https://github.com/electron/electron/releases/download/v1.8.1/electron-v1.8.1-win32-x64.zip","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Copying C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\cache\\electron-windows-amd64-1.8.1.zip to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\bind\\vendor_astilectron_bundler\\electron.zip","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Creating C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\bind\\resources","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Copying C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\resources to C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\astibundler\\bind\\resources","time":"2019-03-18T12:15:11+08:00"}
{"app_name":"","level":"debug","msg":"Generating C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\bind_windows_amd64.go","time":"2019-03-18T12:15:12+08:00"}
{"app_name":"","level":"debug","msg":"Running rsrc for icon C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\resources\\icon.ico into C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\windows.syso","time":"2019-03-18T12:15:14+08:00"}
{"app_name":"","level":"debug","msg":"Removing C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\output\\windows-amd64","time":"2019-03-18T12:15:14+08:00"}
{"app_name":"","level":"debug","msg":"Creating C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\output\\windows-amd64","time":"2019-03-18T12:15:14+08:00"}
{"app_name":"","level":"debug","msg":"Building for os windows and arch amd64","time":"2019-03-18T12:15:14+08:00"}
{"app_name":"","level":"debug","msg":"Executing go build -ldflags -s -X \"main.AppName=Astilectron demo\" -X \"main.BuiltAt=2019-03-18 12:15:14.6180284 +0800 CST m=+2.912462001\" -H windowsgui -o C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\output\\windows-amd64\\binary go-astilectron-demo","time":"2019-03-18T12:15:14+08:00"}
{"app_name":"","level":"debug","msg":"Moving C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\output\\windows-amd64\\binary to C:\\Users\\Administrator-LW\\go\\src\\go-astilectron-demo\\output\\windows-amd64\\Astilectron demo.exe","time":"2019-03-18T12:15:22+08:00"}

still crash.

same here

luis@ubuntu ~/go/src/go-astilectron-demo/output/linux-amd64 (master●●●)$ ./Astilectron\ demo -v                                                                                                                                                                           [ruby-2.6.3p62]
DEBU[0000] Running app built at 2019-04-28 21:39:34.912670978 +0900 JST m=+2.668031964 
DEBU[0000] Skipping restoring resources...              
DEBU[0000] Starting...                                  
DEBU[0000] Provisioning...                              
DEBU[0000] Astilectron has already been provisioned to version 0.30.0, moving on... 
DEBU[0000] Electron has already been provisioned to version 4.0.1, moving on... 
DEBU[0000] Listening...                                 
DEBU[0000] Executing...                                 
DEBU[0000] Starting cmd /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64/electron /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron/main.js 127.0.0.1:34085 false 
DEBU[0000] Stderr says: Error launching app 
DEBU[0000] Stderr says: Unable to find Electron app at /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron/main.js 
DEBU[0000] Stderr says:                                 
DEBU[0000] Stderr says: Cannot find module '/home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron/main.js' 
DEBU[0000] App has crashed                              
DEBU[0000] Stopping...                                  
DEBU[0000] Closing...                                   
ERRO[0000] accept tcp 127.0.0.1:34085: use of closed network connection while TCP accepting 
DEBU[0000] Stopping...                                  
FATA[0000] running bootstrap failed: creating window failed: canceller.cancelled

main.js is not exist.

luis@ubuntu ~/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron (master●●●)$ ls                                                                                                                                                                            [ruby-2.6.3p62]
luis@ubuntu ~/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron (master●●●)$   

Could you ls -l in ~/go/src/go-astilectron-demo/output/linux-amd64 ?

thanks reply.

luis@ubuntu ~/go/src/fotis (master●●)$ ll ~/go/src/go-astilectron-demo/output/linux-amd64                                    [ruby-2.6.3p62]
合計 84M
drwxr-xr-x 4 luis luis 4.0K  4月 28 22:01 ./
drwxr-xr-x 3 luis luis 4.0K  4月 28 22:01 ../
-rwxr-xr-x 1 luis luis  84M  4月 28 22:01 demo*
drwxr-xr-x 3 luis luis 4.0K  4月 28 22:01 resources/
drwxr-xr-x 4 luis luis 4.0K  4月 28 22:01 vendor/

Could you now ls -l in ~/go/src/go-astilectron-demo/output/linux-amd64/vendor ?

uis@ubuntu ~/go/src/fotis (master●●)$ ll ~/go/src/go-astilectron-demo/output/linux-amd64/vendor                                                                                                                                                                          [ruby-2.6.3p62]
合計 72M
drwxr-xr-x 4 luis luis 4.0K  4月 28 22:01 ./
drwxr-xr-x 4 luis luis 4.0K  4月 28 22:01 ../
drwxr-xr-x 2 luis luis 4.0K  4月 28 22:01 astilectron/
-rw-r--r-- 1 luis luis 9.4K  4月 28 22:01 astilectron-v0.30.0.zip
drwxr-xr-x 5 luis luis 4.0K  4月 28 22:01 electron-linux-amd64/
-rw-r--r-- 1 luis luis  72M  4月 28 22:01 electron-linux-amd64-v4.0.1.zip
-rw-r--r-- 1 luis luis   84  4月 28 22:01 status.json

Could you remove the vendor folder and try again?

My guess is there's some kind of mix up with the status.json file.

uum not resolved yet.... sry.

luis@ubuntu ~/go/src/go-astilectron-demo/output/linux-amd64 (master●●●)$ rm -rf vendor
luis@ubuntu ~/go/src/go-astilectron-demo/output/linux-amd64 (master●●●)$ ./demo -v                                                                                                                                             
DEBU[0000] Running app built at 2019-04-28 22:01:09.064669214 +0900 JST m=+2.637743024                                                                                                                                                                                                    
DEBU[0000] Skipping restoring resources...                                                                                                                                                                                                                                                
DEBU[0000] Starting...                                                                                                                                                                                                                                                                    
DEBU[0000] Provisioning...                                                                                                                                                                                                                                                                
DEBU[0000] Provisioning Astilectron...                                                                                                                                                                                                                                                    
DEBU[0000] Removing directory /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron                                                                                                                                                                                 
DEBU[0000] Disembedding vendor_astilectron_bundler/astilectron.zip into /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron-v0.30.0.zip...                                                                                                                        
DEBU[0000] Creating /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor                                                                                                                                                                                                       
DEBU[0000] Creating /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron-v0.30.0.zip                                                                                                                                                                               
DEBU[0000] Disembedding vendor_astilectron_bundler/astilectron.zip                                                                                                                                                                                                                        
DEBU[0000] Copying disembedded data to /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron-v0.30.0.zip                                                                                                                                                            
DEBU[0000] Creating directory /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron                                                                                                                                                                                 
DEBU[0000] Unzipping /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron-v0.30.0.zip/astilectron-0.30.0 into /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron                                                                          
DEBU[0000] Provisioning Electron...                                                                                                                                                                                                                                                       
DEBU[0000] Removing directory /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64                                                                                                                                                                        
DEBU[0000] Disembedding vendor_astilectron_bundler/electron.zip into /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64-v4.0.1.zip...                                                                                                                  
DEBU[0000] Creating /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor
DEBU[0000] Creating /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64-v4.0.1.zip
DEBU[0000] Disembedding vendor_astilectron_bundler/electron.zip
DEBU[0000] Copying disembedded data to /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64-v4.0.1.zip
DEBU[0000] Creating directory /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64
DEBU[0000] Unzipping /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64-v4.0.1.zip into /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64                                                                           
DEBU[0002] System doesn't require finshing provisioning electron, moving on...
DEBU[0002] Listening...
DEBU[0002] Executing...
DEBU[0002] Starting cmd /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/electron-linux-amd64/electron /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron/main.js 127.0.0.1:36673 false                                                          
DEBU[0002] Stderr says: Error launching app 
DEBU[0002] Stderr says: Unable to find Electron app at /home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron/main.js 
DEBU[0002] Stderr says:
DEBU[0002] Stderr says: Cannot find module '/home/luis/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron/main.js'
DEBU[0002] App has crashed
DEBU[0002] Stopping...
DEBU[0002] Closing...
ERRO[0002] accept tcp 127.0.0.1:36673: use of closed network connection while TCP accepting
DEBU[0002] Stopping...
FATA[0002] running bootstrap failed: creating window failed: canceller.cancelled

luis@ubuntu ~/go/src/go-astilectron-demo/output/linux-amd64 (master●●●)$ ll                                                 [ruby-2.6.3p62]
合計 84M
drwxr-xr-x 4 luis luis 4.0K  4月 28 23:09 ./
drwxr-xr-x 3 luis luis 4.0K  4月 28 22:01 ../
-rwxr-xr-x 1 luis luis  84M  4月 28 22:01 demo*
drwxr-xr-x 3 luis luis 4.0K  4月 28 22:01 resources/
drwxr-xr-x 4 luis luis 4.0K  4月 28 23:10 vendor/

luis@ubuntu ~/go/src/go-astilectron-demo/output/linux-amd64 (master●●●)$ ll vendor                                          [ruby-2.6.3p62]
合計 72M
drwxr-xr-x 4 luis luis 4.0K  4月 28 23:10 ./
drwxr-xr-x 4 luis luis 4.0K  4月 28 23:09 ../
drwxr-xr-x 2 luis luis 4.0K  4月 28 23:09 astilectron/
-rw-r--r-- 1 luis luis 9.4K  4月 28 23:09 astilectron-v0.30.0.zip
drwxr-xr-x 5 luis luis 4.0K  4月 28 23:10 electron-linux-amd64/
-rw-r--r-- 1 luis luis  72M  4月 28 23:09 electron-linux-amd64-v4.0.1.zip
-rw-r--r-- 1 luis luis   84  4月 28 23:10 status.json

Can you let me know the content of ~/go/src/go-astilectron-demo/output/linux-amd64/vendor/astilectron-v0.30.0.zip ?

I ran into this issue as well, on MacOS. The repro is simple: run dep init so it creates and populates a vendor/ directory.

I'm used to using dep to manage dependencies and the vendor/ directory, and it wants to put everything that go-astilectron-demo relies on in there. This breaks the demo, and the error is the same.

I was able to fix this with the following steps on MacOS:

Enable vendoring in go-astilectron-bundler and re-install it

cd $GOPATH/src/github.com/asticode/go-astilectron-bundler; dep init; cd astilectron-bundler; go install ./...

Enable vendoring in go-astilectron-demo and rebuild it

cd $GOPATH/src/github.com/asticode/go-electron-demo; dep init; rm bind.go; astilectron-bundler -v

I am now able to double-click on the created Mac App object in output/darwin and it runs as expected.

commented

I have reinstalled all of demo, and fixed this trouble.