Issue with npm install for mac pro

When I do npm install on mac pro, I get below error:

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

Now if I run below code to install xcode cli, I get below error

xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

To resolve this issue, I followed below steps:

# preview path of xcode cli
xcode-select --print-path
# printed `/Library/Developer/CommandLineTools`

# check if path is not correct
sudo xcode-select --switch /Library/Developer/CommandLineTools

# reset path
sudo xcode-select --reset