WebStorm NodeJS

来源:互联网 发布:access数据库能仓库 编辑:程序博客网 时间:2024/04/30 11:00
  1. 按 “Create New Project”
    Screen Shot 2015-12-19 at 1.31.48 pm
  2. 選擇 “Empty Project”。選擇自己的Directory 作為Location。Location 最尾是代表Project Name。改為Hello World
    Screen Shot 2015-12-19 at 1.33.07 pm
  3. 創建一個Javascript 檔案名叫 “helloworld.js”
    Screen Shot 2015-12-19 at 1.41.05 pm
  4. 複製Hello World 程式入helloworld.js 裹。
    Screen Shot 2015-12-19 at 1.43.13 pm

執行HELLO WORLD 程式

執行Hello World 程式。需要預先準備一個執行檔。WebStorm 會根據這個檔案執行程式。

  1. 按下 “Edit Configurations”
    Screen Shot 2015-12-19 at 1.49.57 pm
  2. 按 “+” 並按下”Node.js”
    Screen Shot 2015-12-19 at 1.54.33 pm
  3. 更改Node.js 執行檔資料。
    Name : Hello World  (執行檔的名稱,可以隨自己喜好改亦可)
    Node interpreter : /usr/local/bin/node (安裝Node.js 的時候預設Directory。)
    JavaScript file: helloworld.js (WebStorm 執行Node.js 程式的進入點。進入點意思是第一個首要執行的Javascript)
  4. 按 OK
  5. 按下 “Run” 執行Hello World 程式。
    Screen Shot 2015-12-19 at 2.04.34 pm
  6. 打開Browser,輸入 http://127.0.0.1:1337
    Screen Shot 2015-12-19 at 2.08.41 pm
  7. 恭喜你。在WebStorm 執行你第一個Hello World。
0 0