在尝试使用FeathersJS时,我尝试按照文档创建两个服务。第一个叫x,另一个叫y。
当我用
创建x时~/r/feathers-chat ❯❯❯ feathers generate service
? What kind of service is it? KnexJS
? What is the name of the service? x
? Which path should the service be registered on? /x
? Which database are you connecting to? PostgreSQL
? What is the database connection string?
postgres://user:password@localhost:5432/feathers_chat
一切都很完美。
当我创建y
时~/r/feathers-chat ❯❯❯ feathers generate service
? What kind of service is it? KnexJS
? What is the name of the service? y
? Which path should the service be registered on? /y
? Which database are you connecting to? PostgreSQL
抛出以下错误。
events.js:160
throw er; // Unhandled 'error' event
^
TypeError: Parameter "url" must be a string, not object
at Url.parse (url.js:88:11)
at Object.urlParse [as parse] (url.js:82:5)
at ConnectionGenerator._getConfiguration (/Users/user/.nvm/versions/node/v6.10.2/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:46:24)
at ConnectionGenerator._writeConfiguration (/Users/user/.nvm/versions/node/v6.10.2/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:103:32)
at ConnectionGenerator.writing (/Users/user/.nvm/versions/node/v6.10.2/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:293:10)
at Object.<anonymous> (/Users/user/.nvm/versions/node/v6.10.2/lib/node_modules/feathers-cli/node_modules/yeoman-generator/lib/index.js:417:23)
at /Users/user/.nvm/versions/node/v6.10.2/lib/node_modules/feathers-cli/node_modules/run-async/index.js:25:25
at /Users/user/.nvm/versions/node/v6.10.2/lib/node_modules/feathers-cli/node_modules/run-async/index.js:24:19
at /Users/user/.nvm/versions/node/v6.10.2/lib/node_modules/feathers-cli/node_modules/yeoman-generator/lib/index.js:418:9
at runCallback (timers.js:666:20)
当default.js中定义了postgres连接时,BirdsJS客户端似乎崩溃了
因此,如果我事先创建了连接,则客户端在创建具有相同确切错误的第一个服务时崩溃。
我不明白我做错了什么,对使用同一个postgres数据库创建第二个服务的任何帮助表示赞赏!
答案 0 :(得分:0)
原来在feathers-cli@2.2.2中有一个错误,我卸载并安装了2.1.1版本,我没有遇到任何问题。将通知此错误。