getting-started-with-javascript icon indicating copy to clipboard operation
getting-started-with-javascript copied to clipboard

运行node提示错误,因为多执行了一步node环境

Open chenguoqiang007 opened this issue 6 years ago • 1 comments

运行node程序时,进入到文件夹后,不需要执行进入node环境。 主要原因是看到“>"符号,就认为需要执行进入node环境。因为执行node环境后,也会出现这个符号。所以才导致的这个问题。

正确的流程:

  1. cd getting-started-with-javascript/study/lesson2

  2. node sample_code.js

我的错误的流程:

  1. cd getting-started-with-javascript/study/lesson2

  2. cd lesson2 node

  3. node sample_code.js

chenguoqiang007 avatar Aug 23 '17 16:08 chenguoqiang007

nodejs有两个执行方式。

  1. node的终端运行环境。这个环境可以用于简单的小代码验证。

  2. node的运行环境。这就是正在执行代码的环境。

xugy0926 avatar Aug 24 '17 03:08 xugy0926