Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在windows上安装节点gd_C++_Node.js_Gd_Native_Node Gyp - Fatal编程技术网

C++ 在windows上安装节点gd

C++ 在windows上安装节点gd,c++,node.js,gd,native,node-gyp,C++,Node.js,Gd,Native,Node Gyp,在过去的几个小时里,我尝试在windows上运行node gd。我试过几次回购,终于找到了。当我跑的时候 `npm install node-gd` 我得到以下错误: node-gyp rebuild ...node_modules\node-gd>node "C:\Program Files\nodejs\node_modules\npm\ bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild B

在过去的几个小时里,我尝试在windows上运行
node gd
。我试过几次回购,终于找到了。当我跑的时候

`npm install node-gd`
我得到以下错误:

node-gyp rebuild

...node_modules\node-gd>node "C:\Program Files\nodejs\node_modules\npm\
bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
  node-gd.cpp
..\cpp\node-gd.cpp(17): fatal error C1083: Cannot open include file: 'gd.h': No
 such file or directory [...\node_modules\node-gd\build\node_gd.vcxproj
]
我想我应该安装
gd
lib,但是当我在谷歌上搜索它时,几乎所有的信息都是关于
php\u gd
的,而不是关于lib本身

我应该把
gd
文件放在哪里

编辑:我编译了它!现在我得到:


我最近经历了这个过程,遇到了同样的问题,但没有找到任何解决问题的步骤。我意识到这个线程现在已经有将近1.5年的历史了,但是我会在这里发布我的完整安装步骤,希望它能帮助其他人

这假设您已经构建了GD库(),并且将使用GD DLL

  • 从下载node gd包

    注意:不要在提示符下运行“npm install node gd”,因为这将自动下载并运行安装。您需要首先对包进行一些本地更改,然后在本地安装它

  • 提取后,打开binding.gyp文件,例如位于(downloads\u folder)\node gd\binding.gyp的文件

  • 更改此行:

    "libraries": ["-lgd"],
    
    编译的GD DLL导入库的名称,例如“libgd.lib”:

  • 将GD源路径添加到“include_dirs”,例如:

  • 如果您尝试在此时使用节点gd(通过require),您将得到OP上面出现的“找不到模块”错误。问题不是找不到模块,而是找不到GD DLL(错误消息非常糟糕)。因此,将GD.dll文件复制到节点GD输出目录(它需要位于刚刚构建的节点GD二进制文件旁边),例如:

  • 应该是这样!希望在这一点上一切正常


  • 检查这个@vinayr现在我得到了
    链接:致命错误LNK1181:无法打开输入文件'gd.lib'[…\node\u m odules\node gd\build\node\u gd.vcxproj]
    @Deepsy:找到解决方案了吗?没有。我切换到节点画布,但仍然无法让它工作。所以我浏览了我的旧问题,发现我没有标记这个。我将把这个标记为答案,因为这是一个可能的解决方案。谢谢你的努力。别忘了在新的Windows机器上安装VisualC++ +可再分发包,或者错误的模块NoDEG.G.D。
    "libraries": ["-llibgd"],
    
    "include_dirs": [
      "<!(node -e \"require('nan')\")",
      "(path_to_gd)/src" # <-- THIS ENTRY
    ],
    
    "conditions": [
      [ "OS=='freebsd'", {
        "libraries": ["-L/usr/local/lib"],
        "include_dirs": ["/usr/local/include"]
      }],
      [ "OS=='mac'", {
        "libraries": ["-L/usr/local/lib", "-L/opt/local/lib"],
        "include_dirs": ["/usr/local/include", "/opt/local/include"]
      }],
      [ "OS=='win'", { # <-- THIS ENTRY
        "msvs_settings": {
          "VCLinkerTool": {
            "AdditionalOptions": ["/LIBPATH:(path_to_gd)/build_msvc12_x64"],
          },
        },
      }],
    ]
    
    npm install (downloads_folder)\node-gd
    
    copy (path_to_gd)\build_msvc12_x64\libgd.dll (path_to_node_modules)\node-gd\build\Release\libgd.dll