How to enable color logs in nodejs program running in git-bash v.2.8.2 for windows? - node.js

I had been using Git for Windows 1.9.5 (installed from Git-1.9.5-preview20150319.exe). There was colored output from my nodejs program (gulp) in git-bash terminal. But when I uninstalled 1.9.5 and then installed 2.8.2 (Git-2.8.2-64-bit.exe) all output became monochrome except git-bash prompt line. How to utilize colored output in this newer 2.8.2 version? Or may be there is other suitable 2.x.x version (Visual Studio Code recommends this)

Create a Windows environment variable FORCE_COLOR and set it's value to true or 1.
This solved my issue and all other team-members using Windows who had the same colors problem.

Looks like the reason is in the new default type of terminal: MinTTY (the default terminal of MSYS2). The decision is to utilize a little bit modified (with regard to paths) version of the Git Bash.vbs file from version 1.9.5.

Related

Visual Studio Code: highlighted imports in python

I use Visual Studio Code both on my work Windows laptop, and on my Ubuntu PC at home.
There's a functionality that I can see from my Windows vscode that I'd like to have on my Ubuntu one as well, but can't find whether it's a setting, extension, or something else.
The functionality is this: python imports are highlighted in green, and if they are not used, they are dimmed.
Windows screenshot, how I want it to work:
Ubuntu screenshot, how it currently is:
Does anyone know where I should look? I'm using the same colour theme on both, Monokai.
Thanks!
You will get the linting warnings by pip installing flake8.
You also need to add this setting to your settings.json file:
"python.linting.flake8Enabled": true
I fixed it by installing the extension Settings Sync and syncing settings and extensions of my two installations.
If it was an extension indeed, it probably was fixed by removing the Python Extension Pack and installing Python for VSCode.

Cannot change node version in VS Code terminal

I'm working on Mac and I cannot change node version from terminal window in VS Code
What's interesting, when I open iTerm I have no problems with switching versions. So the problem only seems to appear on VS Code.
Any idea why and how to solve it?
vscode has a shell integration, which you can configure. e.g. placing the following configuration in your vscode settings
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
or you can use the shell launcher plugin, which supports launch multiple shell configurations in the terminal.

VS Code, change NodeJS version for debugger

I want to change NodeJS version from 4.5.0 to 7.7.2 for VS Code specifically for different projects.
I am using nvm on Mac, and I have two versions stated above. They are for different projects.
Even though I can change from terminal with nvm, VS Code uses default version. I need to change the default version every time and completely restart the VSCode.
Is there a way to alter configuration so it picks up the version I wanted
both for in-app terminal and for running project?
After VS Code 1.21, there is a better solution than the original answer.
You can set "runtimeVersion": "7.7.2" and if you have nvm/nvs installed, it will be able to find that version of Node. Details: https://code.visualstudio.com/updates/v1_21#_node-debugging
--- Original answer ---
In your launch config, you can set a path to a Node executable from nvm like this: "runtimeExecutable": "/Users/me/.nvm/versions/node/v7.7.1/bin/node"

Using Visual Studio Code on Windows with Ubuntu-Bash and NodeJS

I'm trying to figure out how to do my web development on Windows using the relatively new Windows Subsystem for Linux (Bash on Ubuntu on Windows) in conjunction with Visual Studio Code. I've configured the IDE to use the Bash in its integrated terminal, and I've set the project up such that the files are accessible in both the Linux and Windows file system.
The last thing I want to get set up is to get the IDE set up with NodeJS, but not NodeJS for Windows. I want it to use an installation of NodeJS in the Linux Subsystem. Does anyone know if it's possible to point VS Code to the Node installation in the Linux Subsystem?
This was a stumbling block for me too, until I found out that the real problem is that there's a pathing issue with WSL that creates a conflict if you already have NPM installed for Windows. Hopefully you've already figured this out yourself, but for anyone else who hits this, I'm copying in an excerpt from my longer guide on Visual C + WSL that's specific to this problem alone.
Given what you've said, I'll assume you already have node and NPM already installed in WSL's Ubuntu.
Using your favorite CLI editor (such as nano, vim, emacs, cat and sed… etc), open your ~/.profile
nano ~/.profile
Note: do NOT attempt to edit Linux files using Windows tools. (Thanks to #david-c-rankin's comment for the official link with the bold red text explaining this) If you don't want to use a CLI editor for this in the terminal, see the bottom of the answer this is excerpted from for a link on how to get a GUI one running.
Currently, the default bash PATH variable in WSL is
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
Which is injecting the windows path after the first two binary directories. Unfortunately, this doesn't result in /usr/bin being used before the windows installed npm, so add that before the final $PATH:
PATH="$HOME/bin:$HOME/.local/bin:/usr/bin:$PATH"
Save out, and then either reload the terminal or just source the path file
source ~/.profile
VSCode (v1.18) now has better WSL support for Node:
I use nvm to install Node on Ubuntu, although it should work fine if you install it normally.
e.g.
nvm install 9.2.0
nvm alias default 9.2.0
From the VSCode docs
If you want to run Node.js in the Linux subsystem on Windows (WSL), you can use the approach from above as well. However to make this even simpler, we've introduced a useWSL flag to automatically configure everything so that Node.js runs in the Linux subsystem and source is mapped to files in your workspace.
Here is the simplest debug configuration for debugging hello.js in WSL:
{
"type": "node",
"request": "launch",
"name": "Launch in WSL",
"useWSL": true,
"program": "${workspaceFolder}/hello.js"
}
I opened bash outside of the vs code and run the following command, to install node.
sudo apt install nodejs-legacy
and I'm able to run node with bash in vs code.

Update nodejs in cygwin

Sometime back I've installed nodejs via cygwin which shows me the version 0.4.12 when I do node -v in bash.
Recently I've installed nodejs with the window installer which shows me the version 0.10.20 in window command prompt.
My Problem is I'm using Claymate for GumbyFramework in cygwin and it requires nodejs version above 0.8.0. How can I update the Nodejs in cygwin to the latest version?
Btw I'm using Windows Vista OS.
Pls. help!! Thanks in Advance..
Please know that Cygwin is not a supported platform. There would be a node version which would break things for you. The latest version that compiles natively on Cygwin is 0.4.12. Though the wiki page mentions some people had success building Node.js 0.10 on MinGW+MSYS. Try the following instructions : http://opensourcepack.blogspot.co.uk/2013/06/nodejs-with-posix-path-support.html
Don't mess with compile on Windows. You may want to just replace the old version Node.exe file with the newer Node.exe file on disk. You should be able to find the Cygwin folders within Windows explorer. You can search the entire disk, in windows not cygwin, for the file name node.exe. You should see the node.exe windows is finding, and the one cygwin is finding, under the cygwin folders.
Rename the cygwin node.exe and copy in the newer node.exe. Now, you nay get an issue with npm, in which case you may want to try the same thing with the npm folder.
I know cygwin isnt officially supported, but when you get it installed correctly it works.

Resources