Open DonKirkham opened 8 years ago
What version of VSCode are you using? The extension basically leverages code --install-extension
on the command line to install extensions. This was introduced in 1.2.0. If code --install-extension
doesn't work in cmd.exe then syncing extensions will not work.
The rest of the extension should be able to work (will need to put out a patch to do so though).
VSCode version 1.4.0. code --install-extension runs with no errors, but I'm not seeing anything in my %USERPROFILE%.vscode\extensions folder, so something is not getting installed (if I understand the installation process.)
I did find that, even though I'm getting errors, there are actual synchronization files in my One Drive App folder. So it appears that the export worked, even with the reported error.
I noticed this error too. Seems you MUST launch Code using Code.cmd or just 'code' in unix. not the start menu shortcut. EDIT: Fixes the error not the addon.
get same error in mac os x upon restart of vs code to enable the extenstion after installation.
Unfortunately reattempting a re installation does not resolve the extension folder to be created in the user profile. As to executing the code.cmd under the C:\Program Files (x86)\Microsoft VS Code\bin folder in a cmd shell fails to create either of the environment variablesVSCode_Dev or Atom...Node. Hmm, looks like at the moment I've landed in a cul-de-sac. Has anyone any suggestions?
Found same issue, and running with the code.cmd file the extension seems to pick up settings correctly (as suggested by @K4pt4n ). Note I can run code from prompt (e.g. code --help or code --list-extensions) so there's no issue with code in path. Is there any way of modifying or checking the sync path once it's initially set, other than reinstalling the extension?
Same issue. If I run from the command line it works fine. If I run from any icon or file association I see the error Code was not found on your path, CodeSync is unable to activate!
. Version VSCode 1.4, CodeSync 2.0
Visual Studio Code knows how to launch additional instances of itself, since it does this every time you test an extension in development. (see execPath
in launch.json) Can you use the same mechanism in CodeSync?
See https://github.com/golf1052/code-sync/blob/master/.vscode/launch.json#L9
For those of you having problem with "code was not found on your path", even though it is, do the following:
It will then launch and will ask you to set up your sync path.
Update, well that does work, however the export file is never created. And if you relaunch as non admin, you get the other error: https://github.com/golf1052/code-sync/issues/11
Yeah, this bug repros for me. Launching from a command prompt is a workaround, but I always launch VS Code from the Windows task bar.
I've noticed with Code 1.6 that I haven't been experiencing this issue at all. Can anybody else confirm?
I just saw this with 1.6.1 and the codesync version 2.1.0. Running as Admin didn't seem to help even from the command prompt.
Have the same problem on OSX 10.11.6 el Capitan, Code version 1.8.1 and 2.1.1 of CodeSync. ๐
Anyone here know JS on OSX? This is where it decides what is constituting whether 'code' is on the path: ~/.vscode/extensions/golf1052.code-sync-2.1.1/out/src/helpers.js (starting at line 84)
function isCodeOnPath() {
let version = '';
try {
version = child_process.execSync(getCodeCommand() + ' --version', { encoding: 'utf8' });
}
catch (e) {
return false;
}
if (version != '') {
return true;
}
return false;
}
exports.isCodeOnPath = isCodeOnPath;
function getCodeCommand() {
if (windows) {
return 'code.cmd';
}
else {
return 'code';
}
}
I would think that modifying getCodeCommand() should get us where we need to be.
problem: "Code was not found on your path, CodeSync is unable to activate!":
close code
change system environment "path" and add "C:\Program Files (x86)\Microsoft VS Code\bin"
launch code
CodeSync will ask you to set up your sync path.
I'm getting this error on Windows 10. VSCode v1.8.1
However, if I start it from the Start Menu shortcut, it works fine.
Are there any fixes to this issue that will work for someone using the portable version of VS Code without Admin access on Windows?
I had the same issue, it's because code is not set up to run from the command line / isn't in your path.
From here: https://code.visualstudio.com/docs/setup/mac
You can also run VS Code from the terminal by simply typing code.
To set it up, launch VS Code. Then open the Command Palette (โงโP) and type shell command to find the Shell Command: Install 'code' command in PATH command.
This fixed it for me.
Additionally, if you're using VS Code Insiders (C:\Program Files (x86)\Microsoft VS Code Insiders\Code - Insiders.exe
) it doesn't work using any of these workarounds...
none of these workarounds have worked for me
Same problem as of today, still no solutions?
I've been pretty busy with finishing up college and moving but hopefully I should be able to take a good look at this within the next month or two.
Still haven't been able to figure out why this is happening but version 2.3.0 makes it so that you will be able to use all the features except for importing or exporting extensions. Importing and exporting of settings, keybindings, and snippets will now work even if CodeSync thinks you don't have code
on your path.
Returning and reviewing this thread, I managed to solve the problem on my Windows box. I discovered that the 'C:\Program Files (x86)\Microsoft VS Code\bin' directory was not in my %Path% environment variable. This was because VS-Code was installed using an Admin account which I do not develop under.
The problem was simply resolved by opening a cmd shell and entering:
setx path "%path%;C:\Program Files (x86)\Microsoft VS Code\bin"
I used setx as I wanted the change to be persistent in my profile.
I hope this helps,
Porky
I have added logging to version 2.4.0 to help with debugging this issue. If you are still experiencing this issue please paste your log here. The CodeSync log is located in the CodeSync output channel.
I am also having this issue, but on macOS (High Sierra). CodeSync reports that code
is not on PATH, but it definitely is. I have manually added it to PATH in ~/.profile
. I also tried installing it using the built in install shell command. In both instances I can launch VSCode from terminal fine, but CodeSync still reports that it's missing.
Further to my previous comment, it looks as though my issue is related to the way that Code is launched, and not anything to do with CodeSync itself.
I am now having similar issues with various internal commands, for example the Run Task command is unable to find node
, and the ESLint extension is unable to find eslint
, despite these both being in PATH.
If I launch Code by clicking on the icon, or by running code
in Terminal, everything works as expected. However, if I launch code via the Alfred app (which is just configured to run the code
terminal command) it all breaks.
I have no idea if this is an Alfred issue or a Code issue.
@jacksleight What $PATH
is Alfred giving to VSCode? If you configure Alfred to run a script saying echo $PATH
what do you see?
How is node
added to your $PATH? Via your .bashrc or nvm?
@cspotcode Node is added via .bash_profile, it's in /opt/local/bin/node
.
I just tried your suggestion and it looks like when Alfred runs it's only getting a PATH with /usr/bin:/bin:/usr/sbin:/sbin
, despite additional paths being exported in .bash_profile. I've added this line to the Alfred shell script and now PATH has everything in it:
source /Users/Jack/.bash_profile
Adding that has fixed the node related issues with ESLint and Run Task. However, it does not seem to have resolved the CodeSync issue. I still get the code is not found on path error when launching through Alfred. Really weird, I would have thought it was the same cause for everything.
Alfred isn't launched via bash, so it's not getting any of your path changes from .bashrc. I'm pretty sure there's another mechanism you need to use to setup environment variables for apps on Mac.
On Tue, Aug 21, 2018, 4:27 PM Jack Sleight notifications@github.com wrote:
@cspotcode https://github.com/cspotcode Node is added via .bash_profile, it's in /opt/local/bin/node.
I just tried your suggestion and it looks like when Alfred runs it's only getting a PATH with /usr/bin:/bin:/usr/sbin:/sbin, despite additional paths being exported in .bash_profile. I've added this line to the Alfred shell script and now PATH has everything in it:
source /Users/Jack/.bash_profile
Adding that has fixed the node related issues with ESLint and Run Task. However, it does not seem to have resolved the CodeSync issue. I still get the code is not found on path error when launching through Alfred. Really weird, I would have thought it was the same cause for everything.
โ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/golf1052/code-sync/issues/9#issuecomment-414810517, or mute the thread https://github.com/notifications/unsubscribe-auth/AAW-uLfab6CUeE9uAXqdEaK_MvbOTFV8ks5uTG0cgaJpZM4JfQf3 .
Same Error on Ubuntu, fresh OS and Application install
Extension Output:
settings.ts 2019-05-02T13:53:51.158Z - Creating settings with internal settings.json path and external extensions.json path: /home/chillbill/.vscode/extensions/golf1052.code-sync-2.5.3/settings.json, extensions.json. helpers.ts 2019-05-02T13:53:51.406Z - Found code version: .
I just got the error on Linux.
Installed VSCode through snap
, which means code is found in /snap/bin (I updated my PATH and I start code always from the command line).
But /snap/bin/code is actually a link to /usr/bin/snap
Code-sync complains it cannot find code
in my PATH
I am in the exact same situation as @gildas
$ which code
/snap/bin/code
$ ls -l /snap/bin
ls -l /snap/bin
total 0
lrwxrwxrwx 1 root root 13 Jan 3 16:12 code -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Jan 3 16:12 code.url-handler -> /usr/bin/snap
And /usr/bin/snap
is an actual binary.
It may help to locate the error messages being logged from this function: https://github.com/golf1052/code-sync/blob/master/src/helpers.ts#L123-L142
...and share them here.
@pingvinen @gildas
For those who've installed VSCode through Snap see this issue: https://github.com/golf1052/code-sync/issues/38
@gildas @pingvinen
I am trying to sync several VMs, all using Windows 10. After enabling the extension and setting the sync folder (using the default in One Drive), I get the following error every time I open VS Code:
Code was not found on your path, CodeSync is unable to activate!
If I try to manually run any commands, like CodeSync: Export All, I get the following:
command 'extension.exportAll' not found.
I have double checked to make sure the path to VS Code is in the Path variable and found it is ("C:\Program Files (x86)\Microsoft VS Code\bin"
Thanks for any help!