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

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

body-parser deprecated undefined extended:提供扩展选项app.js:12:20 module.js:328 throw err; ^

错误:在Module.require(module.js:354:17)上的Function.Module._load(module.js:277:25)处的Function.Module._resolveFilename(module.js:326:15)处找不到模块'firebird' )在要求(内部/ module.js:12:17)在对象。 (/root/Serveur/apishopline/app.js:17:10)在Module._compile(module.js:410:26)位于Module的Object.Module._extensions..js(module.js:417:10)。在Function.Module.runMain(module.js:442:10)处的Function.Module._load(module.js:301:12)处加载(module.js:344:32)

我已经在服务器上安装了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 ,因此创build一个到libfbclient的symklink。

1)寻找libfbclient2

 find /usr/ libfb | grep libfb 

2)转到libfbclient2所在的目录

 cd /path/to/lib/ 

3)创build一个符号链接为了让脚本findlfbclient

 ln -s libfbclient2.so libfbclient.so 

4)重新安装npm模式

 npm install firebird