2013-07-12 15 views
5

Đang cố gắng để kiểm tra compoundjs với mysql nhưng nó không thành công.Compoundjs không chạy với jugglingdb-mysql

hệ thống của tôi là Debian 7 với các phiên bản của nodejs sau & NPM

 
$ node -v 
v0.10.13 

$ npm -v 
1.3.4 

Dưới đây là làm thế nào tôi cài đặt 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 

Sau khi nhận được báo lỗi ở trên tôi đã cố gắng npm install jugglingdb-mysql tôi vẫn gặp lỗi tương tự. Tôi đã thử cài đặt jugglingdb và jugglingdb-mysql trên toàn cầu và cục bộ (không có -g). Tôi tiếp tục nhận được lỗi tương tự.

Trả lời

9

Lỗi là do phiên bản jugglingdb sử dụng trong huy động NPM của jugglingdb-mysql, vì vậy cách duy nhất để sửa chữa nó là để xóa các thư mục và sao chép mà bạn sử dụng trong dự án chính của bạn:

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

Tôi chưa cố gắng cài đặt bộ điều hợp theo cách thủ công từ github, có thể nó cũng hoạt động.

Sự cố được báo cáo tại đây https://github.com/jugglingdb/mysql-adapter/issues/46

+0

Hoạt động !!!! Cảm ơn Jihel! –

Các vấn đề liên quan