Node JS not running from Windows Command Prompt - node.js

I have installed Node Js on Windows 10 64 bit to learn Node JS. When i type
node -v a cmd window flashes and goes away. When i run the node.exe from the program files, i can run the node commands there such as "console.log". Am I missing something?

Moving the Node JS Path variable to the top/ahead, worked.

I had the same problem. I tried uninstalling/reinstalling different versions, but ultimately reinstalling Windows did the trick.

I just had this problem yesterday with windows 8 64 bit version.
On a whim, I checked if the node.exe [right click on the icon] properties have "run as administrator" checked in the compatibility tab. It did. But my command window wasn't in an elevated [administrator] prompt.
I just needed to check the version, node --version.
Unchecking run as administrator stopped the window from disappearing.

What helped me was to change the cmd.exe settings to TrustedInstaller. Right click on cmd.exe -> properties -> security -> change the setting there.

Related

nvm windows installation of node getting stuck on "Extracting..."

I installed the latest nvm Windows cli tool; and when I try to run nvm install lts it shows "Downloading..." then "Extracting..." and freezes there. Never errors, but never moves on, either. If I kill the process and do nvm list, it lists 16.15.0. But if I say nvm use 16.15.0, or nvm uninstall 16.15.0, it says it isn't installed.
I've tried uninstalling nvm and starting over from scratch; same result every time. How do I get past 'Extracting'?
Ok this was a bizarre problem and solution.
Looks like my (work) laptop had previously had win-zip or 7-zip installed, but when it was uninstalled, it didn't re-associate zip files with Windows Explorer.
That meant that the option to click Extract All on a zip file, even manually, was grayed out/disabled. I followed the instructions here: to re-associate .zip files with Windows Explorer:
START menu > Settings (the cog) > Apps > Default Apps. Scroll to the bottom
of that list and look for "Choose default apps by file type". Then
scroll down that until you find ".ZIP" make sure the default is
selected to "Windows Explorer".

How to open VSCode from a Windows Linux Subsystem?

I have VSCode installed on my host OS which is Windows 10 on which I have an Ubuntu Subsystem terminal (WSL) and I'm trying to open VSCode from whitin it with this command code . The problem is that the output is Command 'code' not found. How can I make this work?
Assuming you have installed VSCode in its default place, then in WSL you can do :
PATH="$PATH:/mnt/c/Users/your-user-name/AppData/Local/Programs/Microsoft VS Code"
and run code.exe .
First, try installing the Remote - WSL extension in VSCode (or the meta Remote Development extension pack, which includes the WSL work).
I doubt that's your main problem, but it could help.
Next, try running code . under PowerShell - Does that work? If not, then VSCode isn't in the Windows path. Try reinstalling it -- If it's not in the path, some other associations may not be correctly installed either. I don't recall if there's an option during installation to add or not add it to the Windows path, but if so, it could be that it was deselected during installation.
If it does launch in Windows, then obviously it's in the Windows path. By default, WSL appends the Windows path to the default path in Ubuntu during init. So (again, by default) code . should work in WSL if it is working under PowerShell.
Check your $PATH under Ubuntu (echo $PATH). Is the .../Microsoft VS Code/bin directory (wherever it is installed) in the path? If not, then WSL may not be doing its default append. Edit /etc/wsl.conf under Ubuntu and look to see if there's an [interop] section, as in:
[interop]
appendWindowsPath=false
If so, then change it to true (or, delete it entirely) to allow WSL to add the Windows path. While it's the default setting if missing, you might try adding it and setting it to true (although that shouldn't have any effect).
If that still doesn't work, then check your startup scripts (e.g. .profile, .bash_profile, .bashrc) to see if there are any modifications to the PATH which could be causing this problem.

NPM not recognised in WebStorm and unable to go back to past commands

I am using a mac and currently have node and npm installed. This works fine if I use the normal terminal. But it is not recognised in my Webstorm (using Ultimate version) terminal. Getting following output:
$ node
/bin/ksh: node: not found
$ npm
/bin/ksh: npm: not found
$
Also if I try to click up to go back to past commands, it doesn't work either. I end up with following output:
^[[A
If I try with others such as Java, it works fine as follows:
$ java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
Noticed that Webstorm is definitely picking up my node path considering it is visible when I try to create a new project as shown in following image:
What am I doing wrong? I have seen setups in colleagues laptops and they do not have node/npm set up in bash_profile but everything still works. Could I get some help with this please. Thanks.
It's to do with the choice of your shell. looks like you have chosen to use ksh. Switch it back to something like bash.
I would suggest to do this gobally so that you don't have to keep doing this every time you open a new project.
Thus close your project, click Configure on bottom left and choose Preferences.
Select Tools -> Terminal
Under Application Settings, change your Shell path to /bin/bash (it should be /bin/ksh currently).
Apply and ok. Open your project and try to perform above actions which should work now.

How to install/use Meteor with Babun Windows Shell

so I have a problem here with this custom cmd shell for windows called Babun and using it with meteor. To be honest, I am still a beginner when it comes to the cmd etc... but here is the situation.
So I am working on a meteor website and I am using WebStorm for this, meteor is already installed on my computer and the meteor commands are recognized on the windows cmd. I don't really like the default look of the windows cmd and add to the fact that I have to force it into legacy code mode in order for it to properly work as a terminal for WebStorm. That's why I searched for a more 'feature - rich' cmd and came across Babun which seems pretty handy.
I got as far as getting Babun to work within WebStorm without any problems, but its not recognizing meteor at all like my default windows cmd. This is the error I keep receiving from the console: zsh: command not found: meteor
Which is funny because my default windows cmd can pick it up, why can't Babun or this "oh-my-zsh".
I already tried adding the meteor plugin as instructed here: https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins but meteor is still not being recognized for me. I'm running windows 10 if that helps with the latest versions of both Meteor JS and WebStorm.
If anyone could shed some light into this issue I'm having that would be greatly appreciated!
Did you add the path in the .zshrc file? See how to add path in cygwin. A lot of Babun issue can be resolved by using cygwin solution.
You can confirm by running: which meteor

Vs2013 Nodejs project.. 2nd box..."specified executable is not a valid applications for this OS platfrom

I have a nodejs project in Vs2013
I built it on a w7, 64 bit machine, and it's working, on my main box, check it into TFS and it builds and runs test in Team city. Also runs from a batch file that calls protractor.cmd directly.
I pulled it down on a second box, windows 7, 64 bit
installed Java jdk, VS Node tools, node.js, protractor, VS2013 update 4.
If I run it from the batch file it runs fine. If a debug the project in vs2013 it crashes with the error above
The specified executable is not a valid application for this OS platform.
There are some SO questions that says node.exe is the problem but I searched my drive (with agent ransack) and can't find node.exe anywhere.
I uninstalled the 64 JDK and installed the 32 bit JDK and no joy..
I'm assuming I've installed the wrong version of something.. but I don't know what
Any Ideas? Any Help Is appreciated.
Make sure you added Node.exe to the path.
You said you installed nodejs, so look for Node.exe in something like C:\Program Files\nodejs\
If you can't find Node.exe, then uninstall nodejs and reinstall it and pay attention to where it installs.
Now that you have Node.exe, add it to the path by
right click on My Computer
select Properties
activate the Advanced tab
click the Environment Variables button
edit the Path system variable

Resources