运行 在 Ubuntu 16 服务器上使用 Firebird 的 nodejs 应用程序

Run nodejs app that uses Firebird on a Ubuntu 16 Server

我在 javascript 和 nodejs 中开发了一个 API,现在我尝试在 Ubuntu16 服务器上 运行 它。 API 运行 在我的本地计算机上很好,但在服务器上没有。当我在服务器上启动它时,我有这个错误:

body-parser deprecated undefined extended: provide extended option app.js:12:20 module.js:328 throw err; ^

Error: Cannot find module 'firebird' at Function.Module._resolveFilename (module.js:326:15) at Function.Module._load (module.js:277:25) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (/root/Serveur/apishopline/app.js:17:10) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10)

我已经在服务器上安装了 Firebird 2.5、nodejs v4.2.6、python v2.7.12 和 npm v3.5.2。

所以我尝试使用命令行安装 firebird 模块:

sudo npm install firebird

但是我也有这个错误:

>     /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/libfbclient.so when
> searching for -lfbclient
>     /usr/bin/ld: skipping incompatible /usr/lib/../lib/libfbclient.so when searching for -lfbclient
>     /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/../../../libfbclient.so when searching
> for -lfbclient
>     /usr/bin/ld: skipping incompatible //usr/lib/libfbclient.so when searching for -lfbclient
>     /usr/bin/ld: cannot find -lfbclient
>     collect2: error: ld returned 1 exit status
>     binding.target.mk:133: recipe for target 'Release/obj.target/binding.node' failed
>     make: *** [Release/obj.target/binding.node] Error 1
>     make: Leaving directory '/root/node_modules/firebird/build'
> gyp ERR! build error  gyp ERR! stack Error: `make` failed with exit
> code: 2 gyp ERR! stack     at ChildProcess.onExit
> (/usr/local/lib/node_modules/node-gyp/lib/build.js:258:23) gyp ERR!
> stack     at emitTwo (events.js:87:13) gyp ERR! stack     at
> ChildProcess.emit (events.js:172:7) gyp ERR! stack     at
> Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
> gyp ERR! System Linux 4.4.0-93-generic gyp ERR! command
> "/usr/bin/nodejs" "/usr/local/bin/node-gyp" "rebuild" gyp ERR! cwd
> /usr/local/lib/node_modules/firebird gyp ERR! node -v v4.2.6 gyp ERR!
> node-gyp -v v3.6.2 gyp ERR! not ok  npm ERR! Linux 4.4.0-93-generic
> npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "firebird"
> "-g" npm ERR! node v4.2.6 npm ERR! npm  v3.5.2 npm ERR! code
> ELIFECYCLE
> 
> npm ERR! firebird@0.1.1 install: `node-gyp rebuild` npm ERR! Exit
> status 1 npm ERR!  npm ERR! Failed at the firebird@0.1.1 install
> script 'node-gyp rebuild'. 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 firebird package, npm ERR! not with npm
> itself. npm ERR! Tell the author that this fails on your system: npm
> ERR!     node-gyp rebuild npm ERR! You can get information on how to
> open an issue for this project with: npm ERR!     npm bugs firebird
> npm ERR! Or if that isn't available, you can get their info via: npm
> ERR!     npm owner ls firebird npm ERR! There is likely additional
> logging output above.
> 
> npm ERR! Please include the following file with any support request:
> npm ERR!     /root/Serveur/apishopline/npm-debug.log

您缺少 -lfbclient 库。当前名称和版本是 libfbclient2,因此创建一个指向 libfbclient 的符号链接。

  1. 寻找 libfbclient2

    find /usr/ libfb | grep libfb
    
  2. 进入libfbclient2所在目录

    cd /path/to/lib/
    
  3. 创建符号链接以允许脚本找到 lfbclient

    ln -s libfbclient2.so libfbclient.so
    
  4. 重新安装 npm 模块

    npm install firebird