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

When I write amplify console in react-app, this warning message is coming.

    >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)

And then, amplify console is not opening, blank screen. How to fix this?

Runtime env:

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


Solution 1:[1]

This warning message will only show on Node 16. You can safely ignore the warning, but to get rid of it you can downgrade to Node 14. More information here: https://github.com/aws-amplify/amplify-cli/issues/9939


Update: This was resolved in version 8.0.0 of the Amplify CLI

npm install -g @aws-amplify/cli@latest

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1