3

I have installed Node.js on Windows (binary here http://node-js.prcn.co.cc/ ) and can successfully create an HTTP server in console.

Now I have put same instructions in helloworld.js script in bin directory and run with dos prompt

node helloworld.js 

and it cannot find in /usr/bin. So I put it under Node.js install directory in usr/bin but same message. I finally tried c:/usr/bin but still failed.

So where should I put my script it on windows ?

screencopy of error

enter image description here

8
  • What if you create a .bat file containing node server.js and save node.exe, server.js and that batch file all in the same directory? Commented Jun 18, 2011 at 14:01
  • Can you provide the actual error message please? Commented Jun 18, 2011 at 14:21
  • @Dan see screencopy I added to post thanks. Commented Jun 18, 2011 at 14:46
  • Can you check if any of the locations you listed above corresponds to your /usr/bin directory in cygwin? (I suppose you installed it in cygwin) Commented Jun 18, 2011 at 14:51
  • The author has stated that Node.js is not well supported on Windows, it's mostly a Linux/Unix software now. There is no /usr/bin on Windows. Commented Jun 18, 2011 at 16:37

1 Answer 1

3

Firstly, there are no such thing as DOS prompt in Windows. And if you take effort to create one (e.g. using DosBox or another virtual machine), node.js is not supposed to be run from a DOS prompt as it's a Windows console application and not a DOS application lol. But calling Windows command prompt DOS prompt is a common misnomer, so I hope you really mean that cmd.exe prompt.

Unlike a previous commenter said, Node.js is fully supported under a complete installation of Cygwin, and almost everything works using the stripped Cygwin tree and node.js windows binaries I provide at http://node-js.prcn.co.cc.

So that /usr/bin problem is not related to an incompatibility with windows. You are even not supposed to put your .js files in bin directory of my tree - any location (and normal absolute or relative Windows path) will work.

I created an example.js in bin directory, created console.log("foo") line in it, went to start menu - windows prompt, cd to the bin directory and executed node helloworld.js without any problems.

So as I cannot reproduce your problem, I have a few questions for you:

1) Does node -v work? If yes, what does it say?

2) Did you extract whole tree (e.g. bin, lib directories etc) or just node.exe from the .7z archive I provide?

3) Are you running shell.cmd or a plain windows prompt from start menu or by running cmd.exe ? (all three ways are supported)

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks finally I found the stupid reason: I'm on a new pc with windows 7 when I created helloworld.js it did create helloworld.js.txt but .txt was hidden ... :( :)
Dude, thanks for writing down how you solved your problem. Guess I'm that stupid too. Thought the problem is something with pathing or systemvariables but hey, .js.txt it is. Thanks for providing your solution you helped me very much even you postet this is 2011 :D

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.