Launching Node packages.json scripts from Embedded Terminal in WebStorm - node.js

In WebStorm 2016.2.2 for Windows 7 Professional x64, I would like to go to Tools->Run Gulp/Grunt/npm Task and be able to launch npm tasks from the embedded terminal.
The reason is I am running a yo generator which requires use of the arrow keys to select multiple-choice option outputs, and the default terminal (Run Windows) that WebStorm launches does not support this, but the Embedded Terminal (Alt+F12) functions exactly as intended. Any help is greatly appreciated!

I ended up prepending 'start' to open up a separate terminal window.
For example: "scripts":{"testCmd" : "start cmd.exe #cmd /k \"echo \"hello there\" && exit 1\""}
This opens the command line natively in Windows, prints "hello there", and closes the command line window.

Related

How to use Command Prompt after ng serve was compiled

In Angular 5, after creating project folder, installing Angular CLI, Node.js (all latest versions) and ng serve was compiled successfully through command prompt. Then I tried to use command prompt to install bootstrap. I could not control / use command prompt. What might be the cause and effect?
Command prompt stuck after compilation
There are simple ways:
If you use Command Prompt(Terminal), open another Command Prompt inside your project path.
If you use IDE like Visual Studio Code, open Terminal and then you can use Plus(+) sign for openning anothor Terminal like below image:
If you use IDE like WebStrom (Jetbrains IDE), first open IDE Terminal then make right click and select New Session and new terminal openning like below image:
There are couple of ways you can do that.
The official way of deployment of angular app.
Create a start.bat (if you are using windows) and write the ng serve --open command there. Now you can run this file which will internally run your angular app, using forever or pm2 npm modules.
If you do that these will demonise your process to run in background and your same command prompt becomes usable again.
Once the process is finished( compiled successfully), you would notice that the cmd -prompt newline doesn't show any directory and its blank.
This means that, you just have to open an another (new terminal), get to the right directory using "cd command "and implement your desired commands or operations again.
use ctrl + v it will ask weather to terminate say Y, cursor will go back

How to get a node or cmd terminal in sublime?

Is there a way to run npm commands from Sublime?
For instance, if I wanted to run npm install angular-ui-grid on the current folder in Sublime, how would I do that?
I've looked at posts that say I can build with Node in Sublime, but I don't think that means I can run npm install as if I was in a terminal.
I know you can run a Python terminal from Sublime with Ctrl+`, and you can open a command window at the current location, but is there any way to combine the two?
NOTE: Looking for a Windows cmd or powershell terminal.
I guess, you are looking for TerminalView
This is a Linux/macOS plugin for Sublime Text 3 that allows for terminals inside editor views. The plugin uses a pseudo-terminal to start the underlying shell which means it supports
Interactive applications
Auto-completion
Terminal shortcuts (ctrl+c, etc.)
Password prompt etc.
You can get this package here,
https://packagecontrol.io/packages/TerminalView
Hope this helps!

How to hide node cmd windows created by "pm2 start"

One cmd window per node process, I don't know what these windows for. Can I hide them?
Using AutoHotkey I solved this problem for me on Windows. This will add a tray icon in the notification area of the taskbar (somewhere next to the clock). You can also stop the script itself and the node.js script by right clicking this icon then "Exit".
#SingleInstance, force
OnExit, ExitSub
RunWait, node "main.js", % A_ScriptDir, Hide, pid
ExitApp
ExitSub:
Process, close, % pid
ExitApp
With %comspec% you can write the output to a file if needed. This would then be something like RunWait, %comspec% /c "node "main.js" > "log.txt""
What you can do is, well... in my case I use Visual Studio Code, you forgot to include your IDE in your question. Now with VSC I have integraded the terminal, so I don't really have 3 windows floating around. Now, there is a work-around with windows, which in mac doesn't happen, in order to have the 3 windows you would have to include in your settings:
//Terminal Configurations
//PowerShell Windows
//"terminal.integrated.shell.windows": "C:\\WINDOWS\\system32\\cmd.exe",
//GIT Bash Configuration
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
so when you clik on the plus, it would create a "new window" but not floating around, look:
Btw, you cannot have both activated at the same time, one for bash, one for cmd, I use cmd for my mongodb, and bash for the rest.
You can also substitute bash or cmd for nodejs command line if you wanted to, just put it in one of the routes above :)
Hope it helps!

Run command line app in visible console using NodeJS under Windows

I'm trying to write a command line tool using NodeJS on Windows.
The tool need to execute several other exe's and according to the exit code of each of them progress or stop.
I'm able to run the other exe's using child-process but mostly for debug purposes I'll like to run the other exe inside their own console window. The other exe is doing complex things inside the console window so simply printing out the stdout is not enough.
I've try both exec and spawn and also prefix my other exe with cmd and start but nothing did the trick.

Node.js Command Prompt

I'm trying to learn Node.js. I really like a lot of the ideas I've seen. Currently, I have "Hello, World" working. To run hello world, I simply type node hello.js from a windows command prompt. Now, I'm trying to integrate Node in with Visual Studio as a Tool. Essentially, I want to be able to click the "TOOLS" menu in Visual Studio and choose "Node", and my currently selected file will run in a Node environment.
My question is, how do I do this? Currently, I have the following external tool configured:
Title: &Node
Command: C:\Windows\System32\cmd.exe
Arguments: node $(ItemFileName)
Initial Directory: $(ItemDir)
When I choose "Node" from the "TOOLS" menu, a command prompt window is opened. The directory is set to the directory of the file I've chosen. However, the command "node [filename]" doesn't get executed or entered. What am I doing wrong?
So I replicated the issue you've experienced so I've tried to simply point it to node.exe instead and seems to work pretty well ;)) Will probably end up using this as well!

Resources