我无法在 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) - https
与 http
。
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/