0

I have been programming for a long time using Khan Academy, but now I want to execute the code from my khanacademy program inside netbeans. I downloaded and installed node.js and copied my code into a JavaScript file, but when I try to run it, I get this:

/bin/sh: line 1: node: command not found

I thought it might be because I don't have my code inside a frame, but I can't figure out how to add one.

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
Ethan JC Rubik
  • 174
  • 1
  • 1
  • 12

2 Answers2

0

The problem is that your PATH does not include the location of the node executable. As you are using OSX, execute the following command in the Terminal:

export PATH=$PATH:/usr/local/share/npm/bin
AndreFeijo
  • 10,044
  • 7
  • 34
  • 64
0

Sounds like you don't have node in your path. You can test that by running

which node

If this command doesn't return anything, you need to add node to your path.

export PATH=$PATH;/path/to/node

Edit: Commands assuming Linux/OSX, problem would be the same in Windows but commands would be different.

Blake
  • 83
  • 6