2013-07-15 27 views
5

我使用的是windows 7和nodejs 0.10.12。我裝的永遠是最新版本的模塊,像這樣node.js上的forever模塊不起作用 - 警告

npm install -g forever 

,然後我輸入

forever start helloserver.js 

,我得到以下

warn: --minUptime not set. Defaulting to: 1000ms 
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms 
info: Forever processing file: helloserver.js 

現在,我鍵入

forever list 

只是爲了檢查,我得到

info: No forever processes running 

還要注意,在安裝的過程中永遠我得到了這些警告

package.json [email protected] No repository field. 
package.json [email protected] No repository field. 
package.json [email protected] 'repositories' (plural) Not supported 
package.json Please pick one as the 'repository' filed 
package.json [email protected] No readme data 
package.json [email protected] No readme data 
package.json [email protected] No readme data 
package.json [email protected] No readme data 
package.json [email protected] No readme data 
engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"v.0.10.12","npm":"1.2.32"}) 
engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"v.0.10.12","npm":"1.2.32"}) 
engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"v.0.10.12","npm":"1.2.32"}) 
engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"v.0.10.12","npm":"1.2.32"}) 
engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"v.0.10.12","npm":"1.2.32"}) 

我想永遠的模塊沒有正確安裝因此不能運行服務器?我不明白,我不能想出解決方案。任何建議/提示?我應該使用節點0.8.x嗎?或者有一個解決方法?

感謝

+2

'forever'用於使各種平臺上的服務運行變得容易。這很有幫助,因爲各種Linux發行版在實現服務方面差異很大。但是,在Windows 7中,配置服務很簡單,並且有很好的文檔記錄。我會跳過'永遠',只是使用現有的Windows服務的東西。 –

+0

@GatesVP如果我明白了,建議我不要再擔心'Forever',並在Windows上安裝'helloserver.js'作爲服務。對? – slevin

+0

那麼服務可能會調用'node c:\ path \ to \ helloserver.js',但這是前提。 Windows服務將爲您提供基本的「永久」功能,例如計算機啓動時啓動,失敗時自動重啓等。如果您需要命令行訪問權限,PowerShell將授予您對服務內容的完全訪問權限。 –

回答

3

我想永遠,最後一個版本(0.10.0),在Windows上不穩定的工作,但不是Linux。你可以嘗試下面的方法,但我建議你應該選擇另一種解決方案

forever start -c node script.js 

注意:您不能列出並永遠停在「永久列表」。