我正在尝试使用cli工具在非用featherCLI构建的Featherjs应用中生成身份验证。
我尝试添加所需的所有文件,但现在却给我一个错误。
feathers generate authentication
? What authentication providers do you want to use? Other PassportJS strategies not in this list can still be configured manually. (Press <space> to select, <a> to toggle all, <i> t
o invert selection)Username + Password (Local)
? What is the name of the user (entity) service? users
? What kind of service is it? Sequelize
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'jest' of undefined
at ServiceGenerator.writing (/usr/local/lib/node_modules/@feathersjs/cli/node_modules/generator-feathers/generators/service/index.js:142:45)
at Object.<anonymous> (/usr/local/lib/node_modules/@feathersjs/cli/node_modules/yeoman-generator/lib/index.js:424:27)
at /usr/local/lib/node_modules/@feathersjs/cli/node_modules/run-async/index.js:25:25
at new Promise (<anonymous>)
at /usr/local/lib/node_modules/@feathersjs/cli/node_modules/run-async/index.js:24:19
at self.env.runLoop.add.completed (/usr/local/lib/node_modules/@feathersjs/cli/node_modules/yeoman-generator/lib/index.js:425:13)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
Emitted 'error' event at:
at Immediate.setImmediate (/usr/local/lib/node_modules/@feathersjs/cli/node_modules/yeoman-generator/lib/index.js:433:22)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)```
答案 0 :(得分:2)
我刚刚偶然发现了此错误,它是在您未安装devDependencies时引起的。这是feathersjs-cli上的错误。
\npm\node_modules\@feathersjs\cli\node_modules\generator-feathers\generators\service\index.js
第158行不检查未定义内容:
const tester = this.pkg.devDependencies.jest ? 'jest' : 'mocha';
临时解决方法:安装任何东西作为devDependency,例如jest
npm i --save-dev jest
然后再次运行发电机
答案 1 :(得分:0)
这太复杂了,无法手动完成。一种更快的方法是使用CLI生成项目,然后将所有内容迁移到该项目。为我工作。