gyp: No Xcode or CLT version detected!

I found myself with some errors while installing packages on NPM which was related to xCode.

> npm install

> fsevents@1.2.11 install /Users/user/cloudwales/node_modules/fsevents
> node-gyp rebuild

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:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/Cellar/node/12.11.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/chrisbowen/projects/current/cloudwales/node_modules/fsevents
gyp ERR! node -v v12.14.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

audited 17261 packages in 5.162s

32 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

I managed to find a fix which was to do with the xcode-select path, heres what worked for me:

Open a terminal window and type xcode-select -print-path then sudo xcode-select --reset

> xcode-select -print-path
/Library/Developer/CommandLineTools

> sudo xcode-select --reset

> xcode-select -print-path
/Applications/Xcode.app/Contents/Developer