求助一个小白问题:npm 安装websocket模块出错。。
发布于 12 年前 作者 yesoo 11233 次浏览 最后一次编辑是 8 年前

Mozilla搞了一个nodejs的游戏 我想在本地试试,可是安装模块老出错,郁闷啊 求指导

这个是 那个游戏源码: https://github.com/mozilla/BrowserQuest

下面是log

ERR! websocket@1.0.4 preinstall: make validator

ERR! cmd "/c" "make validator" failed with 1

ERR!

ERR! Failed at the websocket@1.0.4 preinstall script.

ERR! This is most likely a problem with the websocket package,

ERR! not with npm itself.

ERR! Tell the author that this fails on your system:

ERR! make validator

ERR! You can get their info via:

ERR! npm owner ls websocket

ERR! There is likely additional logging output above.

ERR!

ERR! System Windows_NT 6.1.7601

ERR! command “C:\Program Files\nodejs\\node.exe” “C:\Program Files\nodejs \node_modules\npm\bin\npm-cli.js” “install” “websocket”

ERR! cwd D:\Work Files\Node\BrowserQuest\server

ERR! node -v v0.7.7

ERR! npm -v 1.1.15

ERR! code ELIFECYCLE

ERR! message websocket@1.0.4 preinstall: make validator

ERR! message cmd "/c" "make validator" failed with 1

ERR! errno {}

verbose exit [ 1, true ]

14 回复

补张截图 enter image description here

windows下 没有 make 命令, 这个模块安装的时候,有个 preinstall.sh 脚本,这个脚本需要make命令执行一些东西。

用 git-bash 试试,那里带了一个make的

哈 感谢fish的回复,不过make是有了 ‘node-waf’那又报错了,郁闷, 我打算在cygwin下再试试

有个简单的做法,把别人项目里面的socket.io拷过来就行了。mac也没有make命令。。

@fish 我装Poplib也遇到node-waf的问题…同求解。

我也是碰到了这个问题,求解决啊

我找到了一种解决方案,指定websocket的版本为1.0.3,有人说这个版本就够用了 npm install websocket@1.0.3

按照 liu78778 说的指定版本确实安装成功了,,但是还有最后一个问题 enter image description here

我也是卡在这里呢。。在找

@liu78778 这有篇相关文章,不知道你看过没,里面有引一篇老外的解决方法,我还没搞明白咋整= _=

@yesoo 。。地址也给一下啊。。。

@yesoo 主页面只会提示这个“Uncaught SyntaxError: Unexpected token g”

node-waf什么的太郁闷了,在win下是不支持的. 之前安装future出错, 在npm github问了, 人家回答, win下不支持node-waf 要作者换个编译方式

node-waf will never work on Windows. Please bug the forever authors to port to node-gyp instead.

https://github.com/isaacs/npm/issues/1651#issuecomment-4577809

回到顶部