Yeoman-访问循环依赖中模块导出的不存在的属性____



Yo!我正在尝试yeoman,我正在制作一个测试生成器,但正如我在本期中所报道的,有一个小问题。

这是我的代码:

const Generator = require('yeoman-generator');
module.exports = class extends Generator {
// The name `constructor` is important here
constructor(args, opts) {
// Calling the super constructor is important so our generator is correctly set up
super(args, opts);
// Next, add your custom code
this.argument("appname", {type: String, required: false});
}
async prompting(){
const answers = await this.prompt([
{
type: "input",
name: "name",
message: "Your project name",
default: this.appname
},
{
type: "confirm",
name: "cool",
message: "Would you like to enable the Cool Feature?"
},
{
type: "list",
name: "features",
message: "What do you want to make today?",
choices: [
"Some tests",
"Other tests, why not!",
"Another test?",
"Yes."
]
},
{
type: "checkbox",
name: "more",
message: "Anything more?",
choices: [
{
name: "I'm a bit bored",
value: "bored",
checked: true
},
{
name: "I'm busy doing something else.",
value: "smthelse",
checked: false
}
]
}
]);
this.log("app name", answers.name);
this.log("cool feature", answers.cool);
this.log("feature", answers.features);
this.log("more", answers.more.join(" + "))
}
};

基本上,它应该直接提示我这些问题。但以前,我会犯很多错误。

问题之前的输出如下:

(node:35760) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:35760) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:35760) Warning: Accessing non-existent property 'which' of module exports inside circular dependency

我想知道它为什么这么做。

提前感谢您的帮助!

警告来自节点v14.x.x我也不知道为什么节点作者会这样设计。现在,我只需将节点版本从v14.x切换到v12.x或v13.x,警告就会消失。

相关内容

  • 没有找到相关文章

最新更新