输入 amplify 后出现警告消息 "DeprecationWarning: Invalid 'main' field in ....."

Warning message "DeprecationWarning: Invalid 'main' field in ....." after typing amplify

当我在react-app中写amplify console时,出现了这个警告信息。

    >amplify console

    (node:2500) [DEP0128] DeprecationWarning: Invalid 'main' field in
'C:\Users\SAMSUNG\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\cloudform\package.json' of
'packages/cloudform/index.js'. Please either fix that or report it to the module author
    (Use `node --trace-deprecation ...` to show where the warning was created)
    ? Which site do you want to open? ...  (Use arrow keys or type to filter)

然后,放大控制台打不开,黑屏。如何解决这个问题?

运行时环境:

"aws-amplify": "^4.3.16",     //latest
"aws-amplify-react-native": "^6.0.3",    //latest
node: v16.14.0     //latest
npm: 8.3.1         //latest

此警告消息只会在节点 16 上显示。您可以安全地忽略该警告,但要摆脱它,您可以降级到节点 14。更多信息请参见: https://github.com/aws-amplify/amplify-cli/issues/9939


更新: 这已在 version 8.0.0 of the Amplify CLI

中解决
npm install -g @aws-amplify/cli@latest