【问题标题】:Unable to download msnodesql-0.2.1-v0.10-x64.msi无法下载 msnodesql-0.2.1-v0.10-x64.msi
【发布时间】:2020-05-20 22:19:30
【问题描述】:

我无法安装 msnodesql。

原来我试过

npm install node-sqlserver

...这警告它已被 msnodesql 取代。

我成功安装了 Node.js 和 iisnode,我看到示例 Hello.js 正在提供(耶,太棒了),所以至少 node 和 iisnode 都在工作。

我安装了先决条件:

Node.js - use the latest version if possible, but it has been tested on node 0.6.10 and later
node-gyp - latest version installed globally (npm install -g node-gyp)
python 2.7.x - for node-gyp (make sure it is in the path)
Visual C++ 2010 - the Express edition is freely available from Microsoft
SQL Server Native Client 11.0 - available as Microsoft SQL Server 2012 Native Client found in the SQL Server 2012 Feature Pack

...当我运行它时,我得到:

npm install msnodesql

npm http GET https://registry.npmjs.org/msnodesql
npm http 304 https://registry.npmjs.org/msnodesql

> msnodesql@0.2.1 install c:\nodejs\node_modules\msnodesql
> node scripts/install.js

You are downloading Microsoft Driver for Node.js for SQL Server from
Microsoft, the license agreement to which is available at
http://download.microsoft.com/download/6/E/2/6E2D7972-E54D-45AA-
8AB6-41E616035147/EULA.rtf and in the project folder to which the
software is downloaded. Check the package for additional dependencies, which
may come with their own license agreement(s). Your use of the package and
dependencies constitutes your acceptance of their license agreements. If
you do not accept the license agreement(s), then delete the relevant
components from your device.
install.js: Unable to download msnodesql-0.2.1-v0.10-x64.msi
npm ERR! weird error 1
npm ERR! not ok code 0

我使用许可证密钥注册了 C++,所以,有人可以告诉我我在这里缺少什么吗?

请原谅这里的菜鸟问题,但我不得不问,我如何“检查包是否有其他依赖项”? 那具体指的是什么?

【问题讨论】:

    标签: node.js iisnode node-sqlserver


    【解决方案1】:

    出现此问题是因为在 scripts/install.js 中的目标包中,驱动程序的 url 无效。实际上,在 Microsoft 下载中,您会发现 msnodesql-0.2.1-v0.8-x64.msi 而不是脚本中指向的 msnodesql-0.2.1-v0.10-x64.msi。纠正它的唯一方法是从本地驱动器安装它。

    http://www.microsoft.com/en-us/download/details.aspx?id=29995 单独下载驱动器。那么我给你以下建议:

    1. 从下载 Git Hub (msnodesql) 压缩包。解压到本地驱动器
    2. 将解压后目录中的内容替换为

      scripts/install.js
      

      如下:

      var assert=require('assert');
      var subprocess=require('child_process');
      var package=require('../package.json');
      
      function log( msg ) {
          console.log( "install.js: " + msg );
      }
      console.log( "You are installing driver locally." );
      
      var msiName = 'HERE_IS_THE_PATH_TO_YOUR_DOWNLOADED_DRIVER\\msnodesql-0.2.1-v0.8-x64.msi';
      // run the msi to extract the driver inside
      var msiCmd = [ 'cmd', '/c', 'msiexec', '/i', msiName, '/quiet','IACCEPTMSNODESQLLICENSETERMS=Yes', 'NPMINSTALL=Yes' ].join(' ');
      subprocess.exec( msiCmd, function( error, stdout, stderr ) {
          if( error !== null ) {
          log( error );
          log( stdout );
          process.exit( 1 );
          }
      });
      

    然后运行

    npm install FULL_PATH_TO_UNZIPPED_PACKAGE_DIR
    

    安装过程不应失败。在你的应用程序的模块文件夹中将是一个

          msnodesql
    

    包。 然后你应该下载(如果你不是自己构建)

    sqlserver.node
    

    来自 Git Hub(我的声誉不允许向我发布链接,所以如果您需要它,我会回复它)并将其放置到

    msnodesql 模块目录的文件夹。 这应该对您有所帮助。

    【讨论】:

    • 很高兴听到它)如果这对您有用,那就太好了。
    • 这可行,但请记住,反斜杠 (\) 是 Javascript 中的转义字符,因此您必须将其写成双 (\\) 以取消转义。
    • 您正在本地安装驱动程序。 install.js:错误:命令失败:C:\Windows\system32\cmd.exe /s /c "cmd /c msi exec /i E:\msnodesql-0.2.1-v0.8-x64.msi /quiet IACCEPTMSNODESQLLICENSETERMS =Yes NPMINSTALL=Yes" 'cmd' 不是内部或外部命令、可运行程序或批处理文件。
    • 很好的答案!如果从 Github 下载 msnodesql (node-sqlserver) 存档后,只需编辑 scripts 文件夹下的 install.js 文件,通过在 var msiName 上方添加 var msiVer = "v0.8";第 16 行)然后按照@kernel 概述的npm install FULL_PATH_TO_UNZIPPED_PACKAGE_DIR 运行。这将使安装正常工作,无需任何后续步骤。
    【解决方案2】:

    这可以从这里安装:

    http://www.microsoft.com/en-us/download/details.aspx?id=29995

    ...不是来自 npm:

    npm install msnodesql
    

    【讨论】:

      【解决方案3】:

      内核的回答让我大部分时间都在那里。我必须执行几个额外的步骤才能让它工作。

      配置:

      • MS 服务器 2008 R2
      • 节点 v0.10.29 32 位
      • node-gyp v0.13.1
      • python v2.7.7
      • Visual Studio 2013 速成版

      当我尝试按照内核说明安装 msnodesql 时:

      npm install C:\Users\foo\msnodesql
      

      ...我得到了编译错误。

      我根据我在此处阅读的内容进行了修复:https://github.com/Azure/node-sqlserver/issues/168

      很遗憾,他的第二次代码更改没有通过。这是我所做的所有更改:

      Operation.h, line 38, added cast to last argument:
      int result = uv_queue_work(uv_default_loop(), &operation->work, OnBackground, (uv_after_work_cb)OnForeground);
      
      stdafx.h, line 37, added #include to solve shared_ptr issues:
      #include <memory>
      

      在这些更改之后,重新执行我的 npm 安装工作。

      【讨论】:

        【解决方案4】:

        你好,这对我有用

        npm install msnodesqlv8 --save

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2021-10-21
          • 1970-01-01
          • 2021-05-28
          • 1970-01-01
          • 1970-01-01
          • 2017-10-17
          • 2016-12-13
          相关资源
          最近更新 更多