尝试用mysql测试compoundjs但是失败了。
我的系统是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)。我一直得到同样的错误。
答案 0 :(得分: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