nodejs - Windows 中的 npm 安装画布错误 [英] nodejs - npm install canvas error in windows

查看:130
本文介绍了nodejs - Windows 中的 npm 安装画布错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Windows 上安装了 nodejs 并尝试使用以下命令添加画布模块...

I've installed nodejs on windows and tried adding the canvas module using the following command...

npm install canvas

我收到以下错误消息...

I get the following error message...

'node-waf' is not regonized as an internal or external command, operable program or batch file.

有没有办法在 windows 上安装 node-waf 或安装模块的替代方法?

Is there a way to install node-waf on windows or an alternative way to install modules?

推荐答案

我读到您应该尝试使用 Gyp 而不是 node-waf.显然,它也更好地跨平台.

I have read that you should try to use Gyp instead of node-waf. It's apparently better cross platform as well.

在 0.4 版本之前,node.js 团队提供了 node-waf(一个 waf 1.5.3 包装器脚本)来为 node.js 配置和构建模块.这很好,因为在 Windows 中没有本机支持,您必须使用 Cygwin 进行构建.从 0.5 版本开始,node 支持原生的 Windows 构建,从而可以使用 Visual Studio.问题是 waf 从 1.6 版开始支持 Visual Studio 的 msbuild,这是一个重大挫折.与此同时,node.js 团队决定转向 gyp 并放弃了 node-waf 脚本.如果您想创建一个包含 waf 1.6 的 node-waf,请尝试抵制.在 waf 1.6 中发生了很多变化,当我完成修改脚本时,我仍然无法生成正确的 windows 构建(我必须硬连线链接参数,以便将对象链接到 node.lib 仅用于 windows).另一方面,gyp 支持根据构建平台自定义参数,这使得 gyp 文件更易于维护.

Up to version 0.4 the node.js team offered node-waf (a waf 1.5.3 wrapper script) to configure and build modules for node.js. This was fine since in windows there was no native support and you had to use Cygwin to make your builds. From version 0.5 and on, there node supports native windows builds which brings visual studio in to play. The problem is that waf started supporting visual studio’s msbuild from version 1.6 and on and this was a major setback. In the meanwhile the node.js team decided to move on to gyp and abandoned the node-waf script. If you are tempted to create a node-waf wrapping waf 1.6, try to resist. A lot of things have changed in waf 1.6 and when I finished modifying the script, I still couldn’t generate proper windows builds (I would have to hardwire the linking arguments in order to link the object to node.lib just for windows). On the other hand, gyp supports custom arguments depending on the building platform which makes the gyp files easier to maintain.

http://botsikas.blogspot.com/2011/12/nodejs-modules-cross-platform.html

这篇关于nodejs - Windows 中的 npm 安装画布错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆