2013-07-12 59 views
5

嘗試使用mysql測試compoundjs,但失敗。Compoundjs無法使用jugglingdb-mysql運行

我的系統是Debian的7以下的NodeJS的版本& NPM

 
$ node -v 
v0.10.13 

$ npm -v 
1.3.4 

這是我如何安裝compoundjs

 
sudo npm install -g compound 
sudo npm install -g jugglingdb --save 
sudo npm install -g jugglingdb-mysql 

compound init testapp --db mysql 
cd testapp 
npm install
 
$ node server.js 

WARNING: JugglingDB adapter "mysql" is not installed, 
so your models would not work, to fix run: 

    npm install jugglingdb-mysql 


/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55 
     if (!schema.adapter) throw new Error('Adapter is not defined'); 
           ^
Error: Adapter is not defined 
    at init (/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55:36) 
    at CompoundServer.initialize (/srv/www/playground/node/testapp/node_modules/jugglingdb/index.js:31:19) 
    at CompoundServer.EventEmitter.emit (events.js:98:17) 
    at CompoundServer.initCompound (/srv/www/playground/node/testapp/node_modules/compound/lib/compound.js:123:14) 
    at CompoundServer.initCompoundServer [as init] (/srv/www/playground/node/testapp/node_modules/compound/lib/server/compound.js:53:29) 
    at /srv/www/playground/node/testapp/node_modules/compound/lib/compound.js:67:18 
    at process._tickCallback (node.js:415:13) 
    at Function.Module.runMain (module.js:499:11) 
    at startup (node.js:119:16) 
    at node.js:901:3 

收到錯誤後上面我試圖 npm install jugglingdb-mysql 我仍然會得到相同的錯誤。我曾嘗試在全局和本地安裝jugglingdb和jugglingdb-mysql(不帶-g)。我不斷收到相同的錯誤。

回答

9

的錯誤是由於jugglingdb-的MySQL NPM存款使用的jugglingdb版本,所以要解決這個問題的唯一方法就是刪除目錄,並複製你在你的主要項目中使用的一個:

cd $YOUR_PROJECT_ROOT 
rm -rf node_modules/jugglingdb-mysql/node_modules/jugglingdb 
cp -R node_modules/jugglingdb node_modules/jugglingdb-mysql/node_modules 

我還沒有嘗試從github手動安裝適配器,也許它也可以。

的問題在這裏https://github.com/jugglingdb/mysql-adapter/issues/46

+0

工程報道!!!!謝謝Jihel! –