Add Visual Studio Code To $Path, But Code Is A Flatpak?

Hi,

How do I add Visual Studio Code to $Path?
I can’t figure it out because it it a Flatpak.
Thanks!

Create a script to launch the flatpak - save it in ~/.local/bin and make it executable.

1 Like

Ok, make a script to launch a Flatpak.
Can you explain how to do the above?
I’ve been on Manjaro(Arch) for like a week.
Was on Linux Mint for 15 year.
Thank you.

visual-studio-code-bin from AUR

AUR (en) - visual-studio-code-bin

would perhaps avoid the use of the Flatpak
and the PATH issue would thereby … disappear ?

I uninstalled Code Flatpak.
I tried to install Code from AUR.
Building fails with an error.
Error is below:

Removing app/com.visualstudio.code/x86_64/stable
Transaction successfully finished.

Preparing...
Checking code-git dependencies...
Resolving dependencies...
Checking inter-conflicts...
Cloning code-git build files...
Generating code-git information...
Download of npm (10.9.2-1) started
Download of npm (10.9.2-1) finished
Download of yarn (1.22.22-2) finished
Download of ripgrep (14.1.1-1) started
Download of node-gyp (11.0.0-1) started
Download of ripgrep (14.1.1-1) finished
Download of gulp (5.0.0-1) started
Download of node-gyp (11.0.0-1) finished
Download of c-ares (1.34.3-1) started
Download of nodejs-lts-iron (20.18.1-1) finished
Download of gulp (5.0.0-1) finished
Download of zip (3.0-11) started
Download of libngtcp2 (1.9.0-1) started
Download of c-ares (1.34.3-1) finished
Download of zip (3.0-11) finished
Download of libngtcp2 (1.9.0-1) finished
Download of semver (7.6.3-1) started
Download of nodejs-nopt (7.2.1-1) started
Download of semver (7.6.3-1) finished
Download of nodejs-nopt (7.2.1-1) finished
Download of electron29 (1:29.4.6-2) finished
Checking keyring...
Checking integrity...
Loading packages files...
Checking file conflicts...
Checking available disk space...
Installing ripgrep (14.1.1-1)...
Installing c-ares (1.34.3-1)...
Installing nodejs-lts-iron (20.18.1-1)...
Installing nodejs-nopt (7.2.1-1)...
Installing semver (7.6.3-1)...
Installing node-gyp (11.0.0-1)...
Installing npm (10.9.2-1)...
Installing libngtcp2 (1.9.0-1)...
Installing yarn (1.22.22-2)...
Installing gulp (5.0.0-1)...
Installing electron29 (1:29.4.6-2)...
Installing zip (3.0-11)...
Running post-transaction hooks...
Arming ConditionNeedsUpdate...
Updating the desktop file MIME type cache...

Building code-git...
==> Making package: code-git 1.91.0.r122257.gd2d053d84e2-1 (Tue 31 Dec 2024 12:10:33 PM EST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning vscode git repo...
Cloning into bare repository '/var/tmp/pamac-build-jlp/code-git/vscode'...
  -> Found code-git.js
  -> Found code-git.sh
  -> Found product_json.diff
  -> Found clipath.patch
==> Validating source files with sha512sums...
    vscode ... Skipped
    code-git.js ... Passed
    code-git.sh ... Passed
    product_json.diff ... Passed
    clipath.patch ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Creating working copy of vscode git repo...
Cloning into 'vscode'...
done.
==> Starting prepare()...
awk: fatal: cannot open file `.yarnrc' for reading: No such file or directory
==> ERROR: A failure occurred in prepare().
    Aborting...

I don’t use flatpak (and you don’t say what you have already tried) but I can see various discussions about this, for instance this might help

Ok, I installed Visual Studio Code from AUR successfully.
I can not find Visual Studio Code anywhere in the applications menu?
(it should be under: “Development”)

I did install successfully Code from AUR.
Nothing there in applications menu.
Tried to run it in terminal, and got below message:

    ~  code                                                                                           ✔ 
No installation of Visual Studio Code stable was found.
Install it from your system's package manager or https://code.visualstudio.com, restart your shell, and try again.

If you already installed Visual Studio Code and we didn't detect it, run `code version use stable --install-dir /path/to/installation

`

There are several AUR packages that provide VS Code. Please specify exactly which one you installed: visual-studio-code-bin, vscodium, code-git, etc.

The Manjaro repository also provides code, “The Open Source build of Visual Studio Code (vscode) editor.”

Ok, thanks everything is working.

For the benefit of others who may experience similar problems in the future, it would be helpful if you explained what you did to resolve your problems.

2 Likes

@abc123

A version of Visual Studio Code can be installed from the official Manjaro repositories (it’s simply called code) and may resolve this issue (and possibly more resulting from the use of flatpak).

sudo pacman -S code

If you wish to use a foreign package, regardless, please heed the note from @Takakage and fully explain how:

This will allow a real solution to be found by those who might follow in future with the same issue.

Regards.

If your flatpak is vscodium and you want to run it using code command.

It is not much different than a java app packed as jar ([root tip] [How To] I have downloaded a program as a jar file - what now?)

Ensure the ~/.local/bin folder exist

mkdir -p ~/.local/bin

Create the script (this is a herefile - you could use any editor of choice (copy paste line 2 and 3))

cat << EOF > ~/.local/bin/code
#!/usr/bin/env bash
flatpak run com.vscodium.codium "\$@" &
EOF

Make the script executable

chmod +x ~/.local/bin/code