簡體   English   中英

無法在 Windows server 2012 上運行 pm2

[英]No able to run pm2 on Windows server 2012

我在 Windows server 2012 上安裝了pm2

npm install pm2 -g

我關閉了我的 PowerShell 並再次打開它。

當我嘗試運行pm2失敗並出現此錯誤

> pm2 list

pm2 : The term 'pm2' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pm2 list
+ ~~~
    + CategoryInfo          : ObjectNotFound: (pm2:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我注意到PM2_HOME沒有設置,所以我將它設置為我的主目錄中的.pm2 ,但這沒有幫助

任何指針?

有趣的是,我讓它在同一台機器上的另一個帳戶上工作。

在一台 Windows 2012R2 服務器 PM2 上出現同樣的問題,而另一台沒有。 在環境中沒有通往

C:\Users\USERNAME\AppData\Roaming\npm

添加路徑並重新啟動服務器 PM2 后,在 PowerShell 和 CMD 中被識別。

無需將 PM2 路徑添加到系統變量。

在此處輸入圖像描述

有 Bountysource 籌款使 PM2 與 Windows 兼容:

這意味着目前它並不完全兼容。

另請參閱此問題:

來自 Unitech 的評論:

PM2是一個生產模塊,應該主要用在Linux服務器上。 除了Linux,我還沒有在其他平台上嘗試過。

只需在全局模式下安裝 pm2

npm install pm2 -g -s

可以通過將 npm 的路徑添加到 env 設置來解決該問題。 至少這對我有用。

這里如何解決它:

  1. 選擇開始 > 所有程序 > Windows PowerShell 版本 > Windows PowerShell。
  2. 僅類型:Set-ExecutionPolicy Unrestricted

嘗試再次執行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM