gpt4 book ai didi

feathersjs - TypeError : Cannot read property 'jest' of undefined at ServiceGenerator. 写入

转载 作者:行者123 更新时间:2023-12-02 00:54:32 24 4
gpt4 key购买 nike

我正在尝试使用 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)```

最佳答案

我刚刚偶然发现了这个错误,它是在您没有安装 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

然后再次运行生成器

关于feathersjs - TypeError : Cannot read property 'jest' of undefined at ServiceGenerator. 写入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55352038/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com