2014-10-08 32 views
1

我是一個前端開發努力學習,進入Node.js的Node.js的只是返回「......」在終端

在第一關遇到問題。我在蘋果的根的app.js文件:「/」 app.js有以下:

console.log('hello world!'); 

每當我在終端上運行的節點app.js我得到如下:

> node app.js 
... 

回答

1

看起來你首先運行Node.js REPL。不要這樣做...... Node.js REPL用於運行即時評估。

試試從正常的系統終端上運行node app.js

+0

工作正常! 但是,它仍不會按照節點站點上的入門示例運行http服務器。 'var http = require('http'); http.createServer(function(req,res){res.writeHead(200,{'Content-Type':'text/plain'}); res.end('Hello World \ n'); }) .listen(1337,'127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');' – samjhiggins 2014-10-08 17:44:42

+1

@samjhiggins發表一個新的問題,並解釋什麼是/沒有發生。也許你還有其他的東西在那個端口上聽。 – Brad 2014-10-08 17:45:38