TypeError: self.env.emit is not a function at /usr/local/share/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:653:22 at processTicksAndRejections (internal/process/task_queues.js:97:5) Emitted 'error' event on Generator instance at: at Immediate. (/usr/local/share/.config/yarn/global/node_modules/yeoman-generator/lib/index.js:668:20) at processImmediate (internal/timers.js:456:21) error Command failed. Exit code: 1 Command: /usr/local/bin/create-umi Arguments: Directory: /data/projects/umi1 Output:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
yarn global dir找到yarn的全局包的package.json
比如我的是 C:\Users\**\AppData\Local\Yarn\Data\global
打开该文件夹下的package.json,添加
{
"dependencies": {
"create-umi": "^0.20.1"
},
"resolutions": {
"create-umi/yeoman-generator": "4.5.0"
}
}
重新yarn create umi