簡體   English   中英

Node.js在Windows上安裝模塊

[英]Node.js install module on windows

Cmd錯誤:“sh”未被識別為內部或外部命令,可操作程序或批處理文件。

C:\Users\user>npm install -g node-curl
    npm http GET https://registry.npmjs.org/node-curl
    npm http 304 https://registry.npmjs.org/node-curl

    > node-curl@0.1.4 install C:\Users\user\AppData\Roaming\npm\node_modules\node-cu
    rl
    > sh src/generate_curl_options_list.sh && node-waf configure build || true

    "sh" is not recognized as an internal or external command, operable program or batch file.
    "true" is not recognized as an internal or external command, operable program or batch file.

擴展弗洛里安的答案:你在Windows上,沒有cURLsh 您正在嘗試安裝依賴於提供libcurl-library和sh操作系統的模塊,該模塊不隨Windows一起提供。

你有一些選擇:

  1. 編寫自己的節點實現,其行為類似於curl。

    在SO上看到這個問題: nodejs中的卷曲等價物? 它詳細介紹了如何使用內置的http模塊,如curl。

  2. 或者使用像cygwin這樣的工具在windows上安裝libcurlsh 我沒有試過這個,你嘗試安裝的npm模塊可能仍然依賴於cygwin無法解決的其他unix工具。

  3. 或者在http://search.npmjs.org/中尋找與curl相似的其他內容。 嘗試httpsynccurly

我推薦選項1,它會教你基本的http原則。 節點中的本機模塊已經提供了您可能需要卷曲的所有內容。 :)

好吧,在沒有curl的窗口上使用node-curl是非常愚蠢的。

別試試。

暫無
暫無

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

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