繁体   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