Error running capacitor on MacBook Pro with M1 chip

I got this error every time I try to build my Ionic app for iOS devices through capacitor.
On my M1 Mac I’ve downloaded CocoaPods throught Homebrew and it works correctly executing pod command in the terminal.

> capacitor update
[capacitor] (node:25339) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/pietrozarri/Desktop/xplorer/client-ionic/node_modules/tslib/package.json.
[capacitor] Update this package.json to use a subpath pattern like "./*".
[capacitor] (Use `node --trace-deprecation ...` to show where the warning was created)
[capacitor] ✔ Updating iOS plugins in 30.63ms
[capacitor] [info] Found 5 Capacitor plugins for ios:
[capacitor]        @capacitor/app@1.1.0
[capacitor]        @capacitor/haptics@1.1.4
[capacitor]        @capacitor/keyboard@1.2.1
[capacitor]        @capacitor/splash-screen@1.2.2
[capacitor]        @capacitor/status-bar@1.0.7
[capacitor] ✖ Updating iOS native dependencies with pod install - failed!
[capacitor] ✖ update ios - failed!
[capacitor] [error] ERR_SUBPROCESS_NON_ZERO_EXIT
[ERROR] An error occurred while running subprocess capacitor.

it’s not capacitor error, its your node version. you may need to downgrade a version if your using the latest.