为javascript安装quantlib

时间:2017-03-09 20:44:09

标签: javascript linux windows quantlib

我正在尝试在linux和windows上为javascript安装quantlib。在这两种情况下我都会遇到类似的错误。

[idf@node3 ql]$ sudo npm install quantlib
[sudo] password for idf: 

> quantlib@0.2.1 postinstall /home/idf/Documents/js/node_modules/quantlib
> node-pre-gyp install

node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/quantlibnode/quantlibnode/releases/download/v0.2.1/linux-x64.tar.gz
node-pre-gyp ERR! stack     at Request.<anonymous> (/home/idf/Documents/js/node_modules/node-pre-gyp/lib/install.js:120:27)
node-pre-gyp ERR! stack     at emitOne (events.js:101:20)
node-pre-gyp ERR! stack     at Request.emit (events.js:188:7)
node-pre-gyp ERR! stack     at Request.onRequestResponse (/home/idf/Documents/js/node_modules/request/request.js:1029:10)
node-pre-gyp ERR! stack     at emitOne (events.js:96:13)
node-pre-gyp ERR! stack     at ClientRequest.emit (events.js:188:7)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:474:21)
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:363:20)
node-pre-gyp ERR! stack     at emitOne (events.js:96:13)
node-pre-gyp ERR! System Linux 3.10.0-229.1.2.el7.x86_64
node-pre-gyp ERR! command "/usr/bin/node" "/home/idf/Documents/js/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /home/idf/Documents/js/node_modules/quantlib
node-pre-gyp ERR! node -v v6.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.33
node-pre-gyp ERR! not ok 
404 status code downloading tarball https://github.com/quantlibnode/quantlibnode/releases/download/v0.2.1/linux-x64.tar.gz
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open '/home/idf/Documents/js/package.json'
npm WARN js No description
npm WARN js No repository field.
npm WARN js No README data
npm WARN js No license field.
npm ERR! Linux 3.10.0-229.1.2.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "install" "quantlib"
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! quantlib@0.2.1 postinstall: `node-pre-gyp install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the quantlib@0.2.1 postinstall script 'node-pre-gyp install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the quantlib package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs quantlib
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls quantlib
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/idf/Documents/js/ql/npm-debug.log
[idf@node3 ql]$ 

5 个答案:

答案 0 :(得分:1)

您现在可以尝试quantlib.js,它是纯JavaScript,可以在node.js和浏览器中使用

答案 1 :(得分:0)

您是否符合以下要求: enter link description here

答案 2 :(得分:0)

<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
  <div class="col-sm-12">
    <section class="panel panel-default panel-slider">
      <div class="panel-heading">
        <h1 class="panel-title" style="font-size:18px">Test with long description in title panel bla bla
          <a class="more" href="https://example.com" title="" data-toggle="tooltip" data-placement="right" data-original-title="more"><i>x</i></a>
        </h1>
      </div>
      <div class="panel-body">
        <div class="row">
          <div class="col-xs-12 col-sm-12 col-md-8" style="margin-bottom: 10px;">
            ...
          </div>
        </div>

Linux错误指出帽子node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/quantlibnode/quantlibnode/releases/download/v0.2.1/linux-x64.tar.gz 无法在Github中找到Linux的v0.2.1 tarball版本。看一下安装说明,它看起来无法通过npm安装到linux,但必须从头开始手动完成。

答案 3 :(得分:0)

您是否看过错误消息:

https://github.com/quantlibnode/quantlibnode/releases/download/v0.2.1/linux-x64.tar.gz

文件根本就不存在,因此无法做任何事情。检查URL链接。

答案 4 :(得分:0)

我是quantlib.node项目的创建者,对于迟到的回复感到抱歉。

目前,仅提供Windows 32/64位预构建。对于Mac和Linux,您必须自己构建插件。

缺少Mac / Linux预构建的原因是,构建过程有点复杂,在Mac / Linux上我们无法使用预构建的quantlib,我们需要从源代码构建它并添加某些标志:像-std=c++11,这是节点

所需要的

我确实尝试使用静态链接来提升和量化(删除库依赖),生成的插件非常大,200M +(在tar.gz之后)。这样下载不方便。

目前,请按照steps in README.md构建插件,您可能希望使用动态链接构建它,因此生成的插件要小得多。

我会看看我是否可以让这部分更容易,请继续关注