我正在try 运行一个用javascript编写的hello world程序,该程序位于一个名为hello的单独文件中.js
当前正在运行windows版本的 node .js.
这段代码在控制台窗口中运行得很好,但只有how do I reference the path in windows environment个.
C:\abc\zyx\hello.js
在Unix中,我猜它显示$node hello.js
我对诺德绝对是新手.如果我做错了,请纠正我.
我试过了
> node C:\abc\zyx\hello.js
----不起作用
> C:\abc\zyx\hello.js
--没用
UPDATE1:
添加了 node .exe到hello所在的文件夹.js文件正在运行
ReferenceError:未定义hello
请参阅hello的内容.js
setTimeout(function() {
console.log('World!');
}, 2000);
console.log('Hello');
UPDATE 2:
到目前为止,我已经try 了所有这些版本和none of them seems to work.可能是我做错了什么.
>node hello.js
>$ node hello.js
>node.exe hello.js
>node /hello.js
>node \hello.js
> \node \hello.js
> /node /hello.js
> C:\abc\xyz\node.exe C:\abc\xyz\hello.js
> C:\abc\xyz\node.exe C:/abc/xyz/hello.js
> hello.js
> /hello.js
> \hello.js
>node hello
Refer to my file structure
.
├── hello.js
├── node.exe
└── paths.txt
RESOLVED:
c:\>node c:\abc\hello.js
Hello
World! (after 2 secs)