Node.js在Windows上安装模块

new*_*pdv 4 windows module sh node.js

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.
Run Code Online (Sandbox Code Playgroud)

rdr*_*rey 5

扩展弗洛里安的答案:你在Windows上,没有cURL或没有sh.您正在尝试安装依赖于提供libcurl-library的操作系统的模块,该模块sh不随Windows一起提供.

你有一些选择:

  1. 编写自己的节点实现,其行为类似于curl.

    在SO上看到这个问题:nodejs中的卷曲等价物? 它详细介绍了如何使用内置http模块,如curl.

  2. 或安装libcurlsh在Windows上,像一个工具cygwin的.我没有试过这个,你尝试安装的npm模块可能仍然依赖于cygwin无法解决的其他unix工具.

  3. 或者在http://search.npmjs.org/中寻找与curl相似的其他内容.试试httpsynccurly

我推荐选项1,它会教你基本的http原则.节点中的本机模块已经提供了您可能需要卷曲的所有内容.:)