根据官方文档全局安装了npm i @ant-design/pro-cli -g,然后运行pro create myapp,命令行出现:文章来源:https://www.toymoban.com/news/detail-520455.html
PS E:\studio\GIT\ant-design-react-pro\an-pro-new> pro create myapp
C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\src\create\generators\ant-design-pro\index.js:10
const sortPackage = require('sort-package-json');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\node_modules\sort-package-json\index.js from C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\src\create\generators\ant-design-pro\index.js not supported.
Instead change the require of C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\node_modules\sort-package-json\index.js in C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\src\create\generators\ant-design-pro\index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\src\create\generators\ant-design-pro\index.js:10:21)
at C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\src\create\index.js:15:23
at new Promise (<anonymous>)
at runGenerator (C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\src\create\index.js:8:10)
at run (C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\src\create\index.js:35:12)
at Object.<anonymous> (C:\Users\grugu\AppData\Roaming\npm\node_modules\@ant-design\pro-cli\cli.js:60:34) {
code: 'ERR_REQUIRE_ESM'
}
这是什么原因导致的?文章来源地址https://www.toymoban.com/news/detail-520455.html
到了这里,关于ant-design-pro-cli 运行pro create myapp报错Error [ERR_REQUIRE_ESM]: require() of ES Module是什么原因?的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!