1

I'm using raspberry pi3 B and am new to the linux system (raspbian). I was trying to build VS Code into raspberry pi3 according to: https://www.hanselman.com/blog/BuildingVisualStudioCodeOnARaspberryPi3.aspx I've done everything accordingly...

[Original Issue: ERROR: read ECONNRESET]

But when I run the command in the command terminal pi@raspberrypi at the last stage:

pi@raspberrypi:~/vscode $ ./scripts/code.sh
[14:37:12] Using gulpfile ~/vscode/gulpfile.js
[14:37:12] Starting 'clean-electron'...
[14:37:12] Finished 'clean-electron' after 35 ms
[14:37:12] Starting 'electron'...
↓ ffmpeg-v1.7.9-linux-arm.zip [====================] 100%
↓ electron-v1.7.9-linux-arm.zip [=================---] 87%events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at _errnoException (util.js:1022:11)
    at TLSWrap.onread (net.js:615:25)
./scripts/code.sh: line 38: /home/pi/vscode/.build/electron/code-oss: No such file or directory

The first time I did this it shows the same error as above and went on to starting and finishing the compilation smoothly until it reaches:

Finished 'compiling-extensions' after 193 us

and then the terminal just stop here for more than 30min; and my raspi froze; so I did a hard restart -off the power and turn on power- .

2nd try running the same command: it just stop at the no such file or directory command as shown in the first section of code above (did not proceed on to start and finish)

10+++th Try Running:

pi@raspberrypi:~/vscode $ ./scripts/code.sh
[15:24:56] Using gulpfile ~/vscode/gulpfile.js
[15:24:56] Starting 'clean-electron'...
[15:24:56] Finished 'clean-electron' after 22 ms
[15:24:56] Starting 'electron'...
↓ electron-v1.7.9-linux-arm.zip [====================] 100%
[15:31:33] Finished 'electron' after 6.6 min
[7903:0114/153138.657146:WARNING:audio_manager.cc(295)] Multiple instances of AudioManager detected
[7903:0114/153138.657678:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
{ errorCode: 'load',
  moduleId: 'vs/code/electron-main/main',
  neededBy: [ '===anonymous1===' ],
  detail: 
   { Error: ENOENT: no such file or directory, open '/home/pi/vscode/out/vs/code/electron-main/main.js'
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path: '/home/pi/vscode/out/vs/code/electron-main/main.js' } }

and then it stop here for good??.... and nothing is happening. Upon checking, there is indeed nothing in the file: /home/pi/vscode/out/vs/code/electron-main/main.js However, I could not find this file in github repository too as I believe that it is downloaded from somewhere among the packages... The thing is where do I get this file from...

Further repeats of the command would just return this:

pi@raspberrypi:~ $ cd vscode
pi@raspberrypi:~/vscode $ ./scripts/code.sh
[11124:0114/154915.833848:WARNING:audio_manager.cc(295)] Multiple instances of AudioManager detected
[11124:0114/154915.834196:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
{ errorCode: 'load',
  moduleId: 'vs/code/electron-main/main',
  neededBy: [ '===anonymous1===' ],
  detail: 
   { Error: ENOENT: no such file or directory, open '/home/pi/vscode/out/vs/code/electron-main/main.js'
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path: '/home/pi/vscode/out/vs/code/electron-main/main.js' } }
enter code here

Searched online; there's people with the same error but no solution was provided

The full scripts for ./scripts/code.sh are as follow in case you need it:

  #!/usr/bin/env bash

if [[ "$OSTYPE" == "darwin"* ]]; then
 realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
 ROOT=$(dirname "$(dirname "$(realpath "$0")")")
else
 ROOT=$(dirname "$(dirname "$(readlink -f $0)")")
fi

function code() {
 cd "$ROOT"

 if [[ "$OSTYPE" == "darwin"* ]]; then
  NAME=`node -p "require('./product.json').nameLong"`
  CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
 else
  NAME=`node -p "require('./product.json').applicationName"`
  CODE=".build/electron/$NAME"
 fi

 # Node modules
 test -d node_modules || yarn

 # Get electron
 node build/lib/electron.js || ./node_modules/.bin/gulp electron

 # Build
 test -d out || ./node_modules/.bin/gulp compile

 # Configuration
 export NODE_ENV=development
 export VSCODE_DEV=1
 export VSCODE_CLI=1
 export ELECTRON_ENABLE_LOGGING=1
 export ELECTRON_ENABLE_STACK_DUMPING=1

 # Launch Code
 exec "$CODE" . "$@"
}

# Use the following to get v8 tracing:
# code --js-flags="--trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces" "$@"

code "$@"
  • 1
    ECONNRESET means that the connection got reset by the server. As to why that's happening... I don't know. Might be worth giving it a couple more tries to see if the download works this time round; it could just be a temporary thing. I don't think the npm install will do much good; if I remember correctly VS Code has to install a separate version of Electron anyway. – Aurora0001 Jan 14 '18 at 15:12
  • Ohhh, so it had nothing to do with ./scripts/code.sh: line 38: /home/pi/vscode/.build/electron/code-oss: No such file or directory ? Do I have to rectify that? As I understand that I only have the folder named /home/pi/vscode/build/electron/code-oss and .build does not seem to be a terminal command according to: raspberrypi.org/documentation/linux/usage/commands.md I have pasted the full scripts for ./scripts/code.sh above in my post. Just to mention that my system is running slower and slower each time I repeat the command with lesser% of events completed. – GoodCodes Jan 14 '18 at 15:20
  • That error is probably because the download was incomplete, so some of the directories that should be there didn't get downloaded correctly. That then causes the script to fail. If you can get Electron to download correctly, that'll fix the issue. – Aurora0001 Jan 14 '18 at 15:26
  • I realised that when I keep retrying pi@raspberrypi:~/vscode $ ./scripts/code.sh ,this zip folder is no longer repeated too: ↓ ffmpeg-v1.7.9-linux-arm.zip [====================] 100% . Is this normal? Do you kindly have any suggestions on how to get Electron to download correctly? Is the only way out for me to keep re-entering the ./scripts/code.sh command? I have managed to get Electron to download to 100% but another error occur as edited in the post above. Thank you! – GoodCodes Jan 14 '18 at 15:28
  • 1
    You should be okay to leave them there; I don't think it'll cause any harm. If it does, you can always delete them later on. – Aurora0001 Jan 14 '18 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.