node.js - curl http ://npmjs. org/install.sh | sh 在 cygwin 上失败

标签 node.js cygwin npm

我无法在 cygwin 上安装 npm。我已经安装了node v0.4.12,它应该是cygwin上最后支持的nodejs版本。
这是我收到的错误:

curl http://npmjs.org/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    85    0    85    0     0    344      0 --:--:-- --:--:-- --:--:--   904
sh: line 1: syntax error near unexpected token `newline'
sh: line 1: `<html>Moved: <a href="https://npmjs.org/install.sh">https://npmjs.org/install.sh</a>'

请帮我解决这个问题。 TIA。

最佳答案

该错误是因为该 URL 使用 302 重定向进行响应。您需要使用不同的 URL,它只是具有不同的协议(protocol) - httpshttp

curl https://npmjs.org/install.sh | sh

不过,正如我在上面的评论中指出的,您可以在 Windows 上安装 Node 0.8 或更高版本,而无需 cygwin。

关于node.js - curl http ://npmjs. org/install.sh | sh 在 cygwin 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18025970/

相关文章:

javascript - 使用索引作为键初始化对象数组

makefile - 如何在 Cygwin 中运行 makefile

windows - 您可以在64位安装中运行32位Cygwin应用程序吗?

javascript - 在 Node.js 中轻松打印当前包版本

javascript - 如何向 javascript 数组添加新的复杂条目?

javascript - 为什么不推荐使用 fstat

javascript - 将 python 函数转换为 Javascript/node.js

c - Windows 从 cygwin root 获取类似 Unix 的路径

node.js - 无法使用 NPM 安装 BigCommerce Stencil CLI

reactjs - npm postinstall 仅在未安装任何内容时运行