2013-05-03 99 views
0

我正在使用Node.js,Express.js和sqlite3創建一個小型網站。 我已經在Ubuntu中開發了我的項目,並且一直試圖讓它在Mac上也能正常工作。嘗試在Mac上運行Node.js Ubuntu項目時出錯:

但是在我運行svn checkout從我的庫項目的文件夾,並嘗試運行我的app.js文件,我得到以下錯誤:

module.js:356 
    Module._extensions[extension](this, filename); 
         ^
Error: dlopen(/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/build/Release/node_sqlite3.node, 1): no suitable image found. Did find: 
/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/build/Release/node_sqlite3.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 
at Module.load (module.js:356:32) 
at Function.Module._load (module.js:312:12) 
at Module.require (module.js:364:17) 
at require (module.js:380:17) 
at Object.<anonymous> (/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/lib/sqlite3.js:1:104) 
at Module._compile (module.js:456:26) 
at Object.Module._extensions..js (module.js:474:10) 
at Module.load (module.js:356:32) 
at Function.Module._load (module.js:312:12) 
at Module.require (module.js:364:17) 

網站正常工作在Ubuntu。而且,Mac電腦也有Node.js,sqlite3。任何幫助爲什麼發生這種情況將不勝感激。


我刪除了node_modules從我的svn庫,並svn籤我的項目文件夾到Mac電腦。當我NPM安裝的sqlite3我收到以下錯誤:

$ npm install sqlite3 

npm WARN package.json [email protected] No README.md file found! 
npm http GET https://registry.npmjs.org/sqlite3 
npm http 304 https://registry.npmjs.org/sqlite3 

[email protected] install /Users/cs205g1s13/BS/playing/node_modules/sqlite3 node-gyp rebuild

Traceback (most recent call last): 
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp", line 15, in <module> 
import gyp 
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module> 
import gyp.input 
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 15, in <module> 
import multiprocessing 
ImportError: No module named multiprocessing 
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1 
gyp ERR! stack  at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:415:16) 
gyp ERR! stack  at ChildProcess.EventEmitter.emit (events.js:98:17) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (child_process.js:784:12) 
gyp ERR! System Darwin 11.4.2 
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-   gyp.js" "rebuild" 
gyp ERR! cwd /Users/cs205g1s13/BS/playing/node_modules/sqlite3 
gyp ERR! node -v v0.10.4 
gyp ERR! node-gyp -v v0.9.5 
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script. 
npm ERR! This is most likely a problem with the sqlite3 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 their info via: 
npm ERR!  npm owner ls sqlite3 
npm ERR! There is likely additional logging output above. 

npm ERR! System Darwin 11.4.2 
npm ERR! command "node" "/usr/local/bin/npm" "install" "sqlite3" 
npm ERR! cwd /Users/cs205g1s13/BS/playing 
npm ERR! node -v v0.10.4 
npm ERR! npm -v 1.2.18 
npm ERR! code ELIFECYCLE 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /Users/cs205g1s13/BS/playing/npm-debug.log 
npm ERR! not ok code 0 

回答

2

你在你的node_modules支票夾到SVN?不要這樣做。要修復它,請在您的Ubuntu機器上運行npm rebuild。 sqlite使用必須在主機平臺上編譯的擴展。

+0

在Ubuntu中執行npm重建之後,我應該將node_modules文件夾推入存儲庫嗎? – FranXh 2013-05-03 21:08:43

+0

編號svn是爲您的項目的源代碼。 node_modules安裝了第三方軟件。將你的package.json文件檢入svn,但不要留下node_modules。 – 2013-05-03 21:09:57

+0

我按照你的指示,一切工作正常,爲我所有的其他模塊,但不適用於sqlite3 – FranXh 2013-05-03 23:12:45