how to install "visual studio code"?

how to install “visual studio code”?

I want develop c++11 on tx2.
Any IDE or text-editer is ok .
i choice “visual studio code”, but i can’t install it.

hwo to do?
or other good soft.

thank your times.

It looks like the pre-built packages for Linux provided by Microsoft are only for x86_64. For ARM architecture (aarch64), you would need to build it from source from their repo: [url]https://github.com/Microsoft/vscode[/url]

Alternatively, if you have trouble building VS Code from source, I personally use GEdit (“Text Editor” in Ubuntu Unity) with GEdit’s file browser panel on, and keep a Terminal window open for building with CMake and managing my repos with Git.

You might be interested in something like “geany” (not a complete substitute, but is sufficiently light weight combined with features and available on arm64):

sudo apt-get install geany

For a more complete IDE with debugger support, you may also use QtCreator.
Installing it on Jetson is not straight forward however, check this post.

@dusty_nv,

Thanks for sharing this. I’ve been trying to install vscode on my R28.2-DP.
I’ve had to install some extra packages:

apt-transport-https libxkbfile-dev libsecret-1-dev rpm

having already these packages

libx11-dev fakeroot

Also installed nodejs 8.11.2:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

and installed yarn

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn

but when I launch yarn in vscode directory, it fails:

nvidia@tegra-ubuntu:/media/nvidia/Data/VS_Code/vscode-master$ yarn
yarn install v1.7.0
$ node build/npm/preinstall.js
[1/4] Resolving packages...
[2/4] Fetching packages...
info vscode-fsevents@0.3.8: The platform "linux" is incompatible with this module.
info "vscode-fsevents@0.3.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-foreground-love@0.1.0: The platform "linux" is incompatible with this module.
info "windows-foreground-love@0.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-mutex@0.2.0: The platform "linux" is incompatible with this module.
info "windows-mutex@0.2.0" is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-process-tree@0.2.2: The platform "linux" is incompatible with this module.
info "windows-process-tree@0.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[9/13] ⠠ vscode-nsfw
[8/13] ⠠ spdlog
[11/13] ⠠ oniguruma
[12/13] ⠠ electron-mksnapshot
error /media/nvidia/Data/VS_Code/vscode-master/node_modules/electron-mksnapshot: Command failed.
Exit code: 1
Command: node ./download-mksnapshot.js
Arguments: 
Directory: /media/nvidia/Data/VS_Code/vscode-master/node_modules/electron-mksnapshot
Output:
/media/nvidia/Data/VS_Code/vscode-master/node_modules/electron-mksnapshot/download-mksnapshot.js:16
  if (error != null) throw error
                     ^

Error: Failed to find Electron v1.7.0 for linux-arm64 at https://github.com/electron/electron/releases/download/v1.7.0/mksnapshot-v1.7.0-linux-arm64.zip
    at Request.<anonymous> (/media/nvidia/Data/VS_Code/vscode-master/node_modules/nugget/index.js:169:61)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Request.onRequestResponse (/media/nvidia/Data/VS_Code/vscode-master/node_modules/request/request.js:1068:10)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:543:21)

Any idea how to solve it ? Link https://github.com/electron/electron/releases/download/v1.7.0/mksnapshot-v1.7.0-linux-arm64.zip seems wrong.

Thanks.

Also tried:

npm install --save-dev electron-mksnapshot

> electron-mksnapshot@1.7.1 install /media/nvidia/Data/VS_Code/vscode-master/node_modules/electron-mksnapshot
> node ./download-mksnapshot.js

/media/nvidia/Data/VS_Code/vscode-master/node_modules/electron-mksnapshot/download-mksnapshot.js:16
  if (error != null) throw error
                     ^

Error: Failed to find Electron v1.7.0 for linux-arm64 at https://github.com/electron/electron/releases/download/v1.7.0/mksnapshot-v1.7.0-linux-arm64.zip
    at Request.<anonymous> (/media/nvidia/Data/VS_Code/vscode-master/node_modules/nugget/index.js:169:61)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Request.onRequestResponse (/media/nvidia/Data/VS_Code/vscode-master/node_modules/request/request.js:1062:10)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:543:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:112:17)
    at TLSSocket.socketOnData (_http_client.js:440:20)
    at emitOne (events.js:116:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-mksnapshot@1.7.1 install: `node ./download-mksnapshot.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron-mksnapshot@1.7.1 install 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!     /home/nvidia/.npm/_logs/2018-05-24T21_17_16_579Z-debug.log

For reference, attached is the log file.
2018-05-24T21_17_16_579Z-debug.log (285 KB)

Tried cloning ToT with

git clone --recursive https://github.com/Microsoft/vscode.git

instead of using zip file, not better.

And trying:

yarn run watch
yarn run v1.7.0
$ gulp watch --max_old_space_size=4096
[00:34:16] Node flags detected: --max_old_space_size=4096
[00:34:16] Respawned to PID: 31508
module.js:549
    throw err;
    ^

Error: Cannot find module 'gulp-watch'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/media/nvidia/Data/VS_Code/vscode-master/vscode/build/lib/watch/index.js:33:68)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Ok, got it, but it has been a real pain…
The issue is that electron support for arm was a bit erratic in older versions.

Further than these Prerequisites :

cd <where_is_your_vscode_root>
gedit packages.json

Then you will change related lines into:

"electron-mksnapshot": "~2.0.0",
and
"gulp-atom-electron": "^1.17.0",

Then also edit file :

gedit test/smoke/package.json

and change related line into:

"electron": "^2.0.0",

Then you can run:

yarn --arch=arm64
npm rebuild --arch=arm64

The latter may fail, but this step may be required depending on node version mismatch. Although it fails, it should have rebuilt what was in wrong version.
Then, again:

yarn --arch=arm64

and

yarn --arch=arm64 run watch

Once it’s done and shows something like:

[01:41:16] Starting 'watch-client'...
[01:45:01] [monaco.d.ts] Starting monaco.d.ts generation
[01:45:10] [monaco.d.ts] Finished monaco.d.ts generation
[01:45:10] <b>Finished compilation with 0 errors</b> after 233562 ms

then in another shell edit:

cd <where_is_your_vscode_root>
gedit node_modules/gulp-atom-electron/src/download.js

go to function download and force version to 2.0.0:

function download(opts, cb) {
+	opts.version = '2.0.0';
	var repo = opts.repo || 'atom/electron';

This is a nasty way to do, but I have no more time for finding a clean way.

You should then be able to launch vscode with:

./scripts/code.sh

Honey_Patouceu and linuxdev, thank you app is good.

i try build vscode on ubuntu 16.04 (on desktop x64, because i worry tx2 damage).
i am fail, I do not know what to do.
i give up.

i debug code on desktop ubuntu, than copy code to tx2.
becuse it is faster. (build code time and test Features time)

@hunandy14,

These instructions were for native building on TX2. For building on x64, you would probably just install nodejs and yarn, and then in vscode root, just run:

yarn
yarn run watch

and after compilation is finished run

./scripts/code.sh

in another shell.

If you’re trying to cross-compile vscode on x64 for arm64, maybe you can try to pass flag --target_arch=arm64 to yarn, but I haven’t tried it.

BTW, if someone else tried to build vscode natively on TX2, please share if it is working for you or not.

@Honey_Patouceul Thanks for your instruction. I built vscode on TX2 natively with below code. Has some modifications on your code. Comments:
1. add dependency libnss3.
2. remove parameter --arch=arm64.
3. command “yarn run watch” will finish successfully but not exit. Just manually stop it.
4. vscode will update ffmpeg and electron for the first time running.
5. vscode takes ~8 sec to load and show window.
6. totally takes extra ~2.2GB disk space. IMO it’s slow and huge as editor.

# dependencies
sudo apt install git libx11-dev libxkbfile-dev libsecret-1-dev fakeroot rpm libnss3 apt-transport-https

# node.js
wget https://deb.nodesource.com/setup_8.x
sudo bash setup_8.x
sudo apt install -y nodejs
nodejs -v

# yarn
wget https://dl.yarnpkg.com/debian/pubkey.gpg
sudo apt-key add pubkey.gpg
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
yarn --version

# clone code and install all dependencies by yarn
git clone https://github.com/microsoft/vscode
cd vscode
gedit package.json
    "electron-mksnapshot": "~2.0.0",
    "gulp-atom-electron": "^1.17.0",
gedit test/smoke/package.json
    "electron":"2.0.0",
yarn

# build
yarn run watch

# run
 ./scripts/code.sh

@Honey_Patouceul
today i test agin.
Is work! i am successful! (on Tx2)

@zxrgb
this is work!

I really appreciate~

that works for me also! Great!

Did you also know how enable the extension for C++ on TX2 after sucessfuly compile?
Is there also a way to compile the extensions?

thanks for you help

I haven’t used vscode much more and cannot tell, but if you’re ready for building/installing these you may find these here.
It may also be possible to get binaries online and updates, but I cannot tell how.

By the way guys, if anyone wants to use an extension in vscode after it’s installed, my understanding is that it requires the VSIX file (ctrl+shift+p and then type vsix, choose install extension from vsix) and prior to doing that, find that VSIX. I was looking for the one for vscode-python so I found in the github repo that specific extension file (under that link: [url]https://github.com/Microsoft/vscode-python/releases[/url]). Hope this can help someone!! :)

I’v tried to compile visual studio code on my TX2
current specs of the platform:

jetsontx2@jetsontx2-desktop
OS: Ubuntu 18.04 bionic
Kernel: aarch64 Linux 4.9.140-tegra
Packages: 2641
Shell: bash 4.4.19
Resolution: 5760x1080
WM: Mutter(Budgie)
WM Theme: Adwaita
CPU: ARMv8 rev 3 (v8l) @ 4x 2.0352GHz [37.0°C]
GPU: tegra_fb
RAM: 531MiB / 7860MiB

i have been folowing this script:

I’m stuck on Step 7 ( ~$ yarn) with the following message output:

jetsontx2@jetsontx2-desktop:~/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode$ yarn
yarn install v1.16.0
$ node build/npm/preinstall.js
[1/4] Resolving packages…
[2/4] Fetching packages…
info vscode-fsevents@0.3.10: The platform “linux” is incompatible with this module.
info “vscode-fsevents@0.3.10” is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.7: The platform “linux” is incompatible with this module.
info “fsevents@1.2.7” is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.4: The platform “linux” is incompatible with this module.
info “fsevents@1.2.4” is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-ca-certs@0.1.0: The platform “linux” is incompatible with this module.
info “vscode-windows-ca-certs@0.1.0” is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-registry@1.0.1: The platform “linux” is incompatible with this module.
info “vscode-windows-registry@1.0.1” is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-foreground-love@0.1.0: The platform “linux” is incompatible with this module.
info “windows-foreground-love@0.1.0” is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-mutex@0.2.1: The platform “linux” is incompatible with this module.
info “windows-mutex@0.2.1” is an optional dependency and failed compatibility check. Excluding it from installation.
info windows-process-tree@0.2.3: The platform “linux” is incompatible with this module.
info “windows-process-tree@0.2.3” is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies…
[4/4] Building fresh packages…
success Saved lockfile.
$ node build/npm/postinstall.js
Installing dependencies in ‘extensions’.
yarn install v1.16.0
warning package.json: No license field
warning vscode-extensions@0.0.1: No license field
[1/4] Resolving packages…
[2/4] Fetching packages…
[3/4] Linking dependencies…
[4/4] Building fresh packages…
$ node ./postinstall
[##] 2/2removed ‘/home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/extensions/node_modules/typescript/lib/tsc.js’
removed ‘/home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/extensions/node_modules/typescript/lib/tsserverlibrary.d.ts’
removed ‘/home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/extensions/node_modules/typescript/lib/tsserverlibrary.js’
removed ‘/home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/extensions/node_modules/typescript/lib/typescriptServices.d.ts’
removed ‘/home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/extensions/node_modules/typescript/lib/typescriptServices.js’
Done in 0.58s.
Installing dependencies in ‘remote’.
yarn install v1.16.0
warning package.json: No license field
warning vscode-reh@0.0.0: No license field
[1/4] Resolving packages…
[2/4] Fetching packages…
info vscode-fsevents@0.3.10: The platform “linux” is incompatible with this module.
info “vscode-fsevents@0.3.10” is an optional dependency and failed compatibility check. Excluding it from installation.
info vscode-windows-ca-certs@0.1.0: The platform “linux” is incompatible with this module.
info “vscode-windows-ca-certs@0.1.0” is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies…
[4/4] Building fresh packages…
[1/7] ⡀ keytar
[2/7] ⡀ native-watchdog
[3/7] ⡀ node-pty
[4/7] ⡀ spdlog
error /home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/remote/node_modules/native-watchdog: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/remote/node_modules/native-watchdog
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@8.16.0 | linux | arm64
gyp http GET http://nodejs.org/dist/v10.11.0/node-v10.11.0-headers.tar.gz
gyp http 200 http://nodejs.org/dist/v10.11.0/node-v10.11.0-headers.tar.gz
gyp http GET http://nodejs.org/dist/v10.11.0/SHASUMS256.txt
gyp http 200 http://nodejs.org/dist/v10.11.0/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ ‘/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py’,
gyp info spawn args ‘binding.gyp’,
gyp info spawn args ‘-f’,
gyp info spawn args ‘make’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/remote/node_modules/native-watchdog/build/config.gypi’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/home/jetsontx2/.node-gyp/10.11.0/include/node/common.gypi’,
gyp info spawn args ‘-Dlibrary=shared_library’,
gyp info spawn args ‘-Dvisibility=default’,
gyp info spawn args ‘-Dnode_root_dir=/home/jetsontx2/.node-gyp/10.11.0’,
gyp info spawn args ‘-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp’,
gyp info spawn args ‘-Dnode_lib_file=/home/jetsontx2/.node-gyp/10.11.0/<(target_arch)/node.lib’,
gyp info spawn args ‘-Dmodule_root_dir=/home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/remote/node_modules/native-watchdog’,
gyp info spawn args ‘-Dnode_engine=v8’,
gyp info spawn args ‘–depth=.’,
gyp info spawn args ‘–no-parallel’,
gyp info spawn args ‘–generator-output’,
gyp info spawn args ‘build’,
gyp info spawn args ‘-Goutput_dir=.’ ]
gyp: name ‘build_v8_with_gn’ is not defined while evaluating condition ‘build_v8_with_gn == “true”’ in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.9.140-tegra
gyp ERR! command “/usr/bin/node” “/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /home/jetsontx2/jetson_software/visual_studio_code_source/new_installation_13_06_2019/vscode/remote/node_modules/native-watchdog

error Command failed with exit code 1.
info Visit yarn install | Yarn for documentation about this command.

I do not really know how to deal with it. Did someone stumbled upon the same issue and can point me in the right direction?

You may try this.

#Install Node.JS - version >= 10.15.1, < 11.0.0 can solve the problem
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

To enable extensions, edit the product.json file and add the following:

“extensionsGallery”: {
“serviceUrl”: “https://marketplace.visualstudio.com/_apis/public/gallery”,
“cacheUrl”: “https://vscode.blob.core.windows.net/gallery/index”,
“itemUrl”: “https://marketplace.visualstudio.com/items
}

Hello Folks,

I have made a video that demonstrates the procedure to install VScode for C/C++ on Jetson TX2.

After a lot of trials, I succeeded with the installation on my TX2. So, thought of documenting it as it might save time for people who are trying it out new.

Cheers,
Sai