Why do node tasks spawn new console when run from PowerShell? - node.js

On Windows 10, when I run Node.js commands (e.g. node -v) from a PowerShell console, they always spawn a new Windows Command console. When I run the same commands from a Windows Command prompt, they run in that same console session. Interestingly, whatever this is appears to cause the same behavior when running Node commands via the Task runner in Visual Studio Code and when Visual Studio 2017 build steps contain Node commands - each Node command run spawns a new console. This only started about a week or so ago. I don't recall any updates to my PC that could be related. Other developers on my team that use the same tools don't experience this same behavior. I have another PC that this doesn't occur on. What could be causing this?
Windows 10
Node.js v7.8

Related

How to run detox for react-native projects on windows and linux?

I am currently using windows 10. I want to be able to run detox test scripts on android emulators. Is this possible?
I tried to do it many times but failed. Each time I do it, some configuration issue pops up and build gets failed.
The CI/CD server is hosted on a Linux machine, so assuming we can do this, will it run there?
Also is there any good guide available to help in setting up and running detox for react-native projects on windows?

How to run a command in Developer command prompt 2019 using Python

I'm trying to do build in Developer Command Prompt of VS 2019 using Python script.
Here is piece of code i'm using:
import os
os.system('start /wait C:/Windows/System32/cmd.exe "msbuild C:/Users/Desktop/Project/Project.sln"')
os.system("pause")
But it is not working.Developer command prompt is appearing for just 1sec and disappearing .
When i took variable to check if command was succesful or not ,it is giving variable result as zero,which means command is successful but i'm not able to see it in Developer command prompt.
result= os.system('start /wait C:/Windows/System32/cmd.exe /k ipconfig')
print (result)
Whereas when i'm trying the same command in windows command prompt it's working fine.
How to run a command in Developer command prompt 2019 using Python
Developer command prompt 2019 is a tool which is integrated into VS2019 IDE and provides environment parameters for various development modules.
However, the CMD.exe does not have these environment variables for these, so you cannot just use CMD.exe directly. Sorry that I am not familiar with python code and script. I suggest you could configure Developer command prompt 2019 into System environment variable PATHand then call cmd.exe which integrates the related variables to build your projects without any errors.
Suggestion
First, if you build your project on another new agent, you should install one of tool from step 1.
1) If you install VS2019 IDE in your local agent,please make sure that your local agent has VS2019 IDE and install the related workload about your project type.
Besides, if you install Build Tool for VS2019, please also install the related workload.
2) set the below path under System environment variable PATH
VS2019 IDE:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
Build Tool for VS2019:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
3) Then you can call your python script as you described to build your projects.
Any feedback and concern will be expected.

VSCode with WSL - How to use Bash for the launch configurations?

I use Visual Studio Code to develop a TypeScript Node application on Windows 10, with WSL enabled.
Thanks to other threads, I'm almost able to run a VSCode task with Bash on Ubuntu on Windows.
But now I try to do the same with a launch configuration. How can I make a launch configuration to use the node executable installed in WSL instead of the one installed on Windows?
If I run this command directly in the integrated terminal, with Bash, it works :
node src/start.js
But when I press "[F5]" and start a launch configuration that runs this same file, I get an error : "Error: %1 is not a valid Win32 application". This is because the oracledb library is used and has been compiled in Bash, not in Windows.
How can I make a launch configuration use Bash to run Node?
UPDATE : I opened an issue about that on VSCode's GitHub page.
Not if sure you still need help.
open bash outside of the vs code.
then run the following command, to install node.
sudo apt install nodejs-legacy
and you should be able to run node with bash in vs code.

visual studio code nodejs request 'launch': cannot launch target (reason: spawn node ENOENT)

When I use visual studio code to debug a nodejs app.
visual studio code tell me request 'launch': cannot launch target (reason: spawn node ENOENT)
My nodejs version is 4.2.4
Managed to get past this when running on Windows by specifying npm.cmd instead of npm in the VS code debug configuration like so
"runtimeExecutable": "npm.cmd",
Some discussions are posted in this here
How do I debug "Error: spawn ENOENT" on node.js?
Especially, the following points should be checked
Ensure the environment variable PATH is set
PATHEXT environment variable that can cause certain calls to spawn to not work on Windows.
I was getting this error on a Debian Linux system. I noticed the same thing worked OK on Windows.
Next I noticed that the Node.JS executable is called node on Windows but on Debian (and on Debian-based systems such as Ubuntu) it's called nodejs. So I created an alias - from a root terminal, I ran
ln -s /usr/bin/nodejs /usr/local/bin/node
and this solved the problem.
This usually happens if you already had your Visual Code Editor running while installing node js on Windows OS. I would advise you to shut down your Visual Studio Code and restart it. This problem should go away.
If not do a machine reboot and verify if the debug works flawlessly

prevent webpicmd from sending output to new window in windows 8

After installing the latest version of WebPICmd.exe from the chocolatey gallery (https://chocolatey.org/packages/webpicommandline, 7.1.1374) on windows 8 I am not able to use the problem. For some reason the command output is going to a new console window, which immediately closes. I am running the command from PowerShell.
On Windows 7, it behaves nicely and the output of webpicmd.exe goes to my current window. I cannot imagine why it would work otherwise for windows 8.
Can you try launching your CMD (One you run WebPICmd in) as Administrator.

Resources