Why there is difference in path reference for node.js program hello.js?
In my earlier program, I had trouble in referencing hello.js file and run using node.js on windows. Please check this How to run a hello.js file in Node.js on windows?
setTimeout(function()
{
console.log('world!');
},2000);
console.log('hello');
When I was at work place I was able to run the above program using the following syntax:
c:\>node c:\abc\hello.js
But when I came home and tried using the same syntax, the same program did not run. When I tried using the following syntax it wor开发者_Python百科ked. Why is this difference? Is this because of path variable or something else?
C:\>C:/njs/node.exe C:/njs/hello.js
hello
world!
Thanks in advance.
It seems that in the second computer, node is not on your PATH variable.
Please check this by doing:
echo %PATH%
from the command line.
If so you need to modify PATH
and add node binaries there, see this link:
http://www.computerhope.com/issues/ch000549.htm
精彩评论