I just installed node.js.
I tried writing node -v that should check the version — and it’s not working. this is the output:
> node -v ReferenceError: node is not defined
at repl:1:2 at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.emit (events.js:98:17)
at emitKey (readline.js:1095:12) >
I opened it using git — command: node
I tried running it using «Git», thought maybe that’s the issue and I get the exact same output.
I am using windows 8 if it’s relevant — followed this tutorial till now:
How do I make it work?
asked Nov 27, 2014 at 11:48
ImnotapotatoImnotapotato
5,16913 gold badges77 silver badges145 bronze badges
9
It looks like you have entered the node REPL and then typed node -v
The good news is that this means node is working!
To check the version from here you can type process.version
to get the node version. Alternatively type process.exit()
to exit the node REPL and get back to bash (or equivalent terminal).
From here node -v
should just output the node version.
answered Nov 27, 2014 at 14:22
3
Edit
First time using node.js
Although already answered, but just putting in my 2-cents,
Normally, the first time users would trip over it, so am posting some screen shots, and that OP wants to try node -v
, so making it a bit easier to follow.
The Wrong !!
The Correct !!
or you can do ..
Hope it helps someone.!
answered Jan 23, 2017 at 19:22
IrfIrf
4,2352 gold badges36 silver badges48 bronze badges
4
Instead of node.exe, try to run node from «Node.js command prompt«.
First, you should install nodejs.msi from nodejs.org.
Once installation is completed, go to: Start > All Programs > Node.js > Node.js command prompt.
It worked for me.
answered Mar 8, 2015 at 0:08
Bernard DociBernard Doci
7292 gold badges14 silver badges23 bronze badges
4
Even I faced the same when I install the NODE server and Try to execute «node-v» command from directly clicking on start up menu’s NODE ICON.
Instead of doing that all you need to do is GO TO command prompt then go to C:/program files/node path and type «node -v» command it will definitely going to display you the version of NODE.
Milap
6,8658 gold badges25 silver badges46 bronze badges
answered May 26, 2016 at 13:40
Follow below Steps:
- Open command prompt: RUN > CMD
- Navigate to folder where nodejs is installed: C:usersname>cd path_of_nodejs
- Open nodejs: C:path_of_nodejs>node
- Exit from node REPL mode: >process.exit()
- You are ready for your node commands: >node -v
answered Jun 26, 2017 at 10:30
0
Try opening up a new terminal (Run -> CMD) and then executing:
node /your_file_name.js
And to see which version you have installed, just execute:
node -v
answered Jul 19, 2016 at 10:48
Thanks for this help.
If you are using windows, like me, and want a desktop shortcut and you already have the nice node.js desktop icon, edit the shortcut properties like this:
- right click and select properties
- click change Icon, select the current icon and click OK (to lock it in)
- in the target box, change it all to simply say cmd or c:windowsSystem32cmd.exe if you are pedantic.
now you have a command prompt, with the node.js icon, that opens in the folder you expect, that responds correctly to the node -v command.
answered Aug 4, 2017 at 0:33
trevortrevor
2573 silver badges9 bronze badges
Hi,
I have installed, NodeJs and tried the command node -v but getting the error Uncaught ReferenceError: node is not defined.
Text from the console:
Welcome to Node.js v14.16.1.
Type «.help» for more information.
node -v
Uncaught ReferenceError: node is not defined
- Version:
- Platform:
- Subsystem:
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
What is the expected behavior?
What do you see instead?
Additional information
Issue
I just installed node.js.
I tried writing node -v that should check the version – and it’s not working. this is the output:
> node -v ReferenceError: node is not defined
at repl:1:2 at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.emit (events.js:98:17)
at emitKey (readline.js:1095:12) >
I opened it using git – command: node
I tried running it using “Git”, thought maybe that’s the issue and I get the exact same output.
I am using windows 8 if it’s relevant – followed this tutorial till now:
How do I make it work?
Solution
It looks like you have entered the node REPL and then typed node -v
The good news is that this means node is working!
To check the version from here you can type process.version
to get the node version. Alternatively type process.exit()
to exit the node REPL and get back to bash (or equivalent terminal).
From here node -v
should just output the node version.
Answered By – benbrunton
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0
Trying to make node.js work with command node -v and end up with an error
node -v ReferenceError: node is not defined
You are probably trying to run the command in REPL virtual environment
In order to check node.js version go to the folder with node.js files and run command from command prompt
About REPL
REPL ( Read- Eval-Print -Loop) is an virtual environment that comes with Node.js. It is tool to test simple Node.js javascript code.
Learn more here about REPL
Совсем недавно писал код в webstorme ,все было нормально
На следующий день захожу и мне выводит ошибку
E:nodejsnode.exe E:OSPaneldomainsworkprogram.js
E:OSPaneldomainsworkprogram.js:1
alert(‘вывф’);
^
ReferenceError: alert is not defined
at Object. (E:OSPaneldomainsworkprogram.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Я понял,что проблема в самом ноде
При попытке ввести проверки версии node -v выводится такая же ошибка node is not defined
То есть ни одна команда не работает и сам нод,переустановка не помогла