2

This is what my file test.js contains:

console.log("Hello Stackoverflow");

This is what happens when I attempt to run it:

$ ls
test.js
$ node test.js
$ node test
$ node "test"
$ node "test.js"
$ node --debug test.js
debugger listening on port 5858
$ node --debug test
debugger listening on port 5858
$ 

Notice that it never works :( I can run just "node" and evaluate javascript statements line by line but whenever I try to run a script as above it does not work.

I'm running OS X 10.8 and a brand new installation of nodejs.

3
  • I'm not on a Mac, but I'm unable to reproduce this (Win 7 x64, node v0.10.16). Commented Aug 23, 2013 at 19:44
  • Odd.. it works just fine over here Commented Aug 23, 2013 at 19:49
  • It's very odd that node test doesn't return an error. Perhaps node is aliased to something. Commented Aug 23, 2013 at 22:18

1 Answer 1

2

The solution to my problem was to uninstall node using:

sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}

I then installed brew on my mac:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

And then I did

brew doctor

I fixed the issues it told me to fix from that, and then I did

brew install node

I then restarted terminal, and node was working.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.