Error with running `npm install` from project root

Hello, when I run npm install from the root directory I get a bunch of errors on my terminal, am using Mac Os Catalina. Please I'll appreciate getting help solving this.

Versions of Node and Npm currently installed

node --version: v14.16.0
npm --version: 6.14.11

Error log

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> root@ postinstall /Users/jay/joplin
> npm run bootstrap --no-ci && npm run build


> root@ bootstrap /Users/jay/joplin
> lerna bootstrap --no-ci

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Bootstrapping 15 packages
lerna info Installing external dependencies
lerna ERR! npm install exited 1 in 'joplin'
lerna ERR! npm install stdout:

> fsevents@1.2.11 install /Users/jay/joplin/packages/app-cli/node_modules/fsevents
> node-gyp rebuild


> keytar@7.0.0 install /Users/jay/joplin/packages/app-cli/node_modules/keytar
> prebuild-install || node-gyp rebuild


lerna ERR! npm install stderr:
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
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:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jay/joplin/packages/app-cli/node_modules/fsevents
gyp ERR! node -v v14.16.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
prebuild-install WARN install No prebuilt binaries found (target=14.16.0 runtime=node arch=x64 libc= platform=darwin)
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:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jay/joplin/packages/app-cli/node_modules/keytar
gyp ERR! node -v v14.16.0
gyp ERR! node-gyp -v v5.1.0
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

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keytar@7.0.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the keytar@7.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jay/.npm/_logs/2021-03-16T00_27_52_163Z-debug.log

lerna ERR! npm install exited 1 in 'joplin'
lerna WARN complete Waiting for 2 child processes to exit. CTRL-C to exit immediately.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! root@ bootstrap: `lerna bootstrap --no-ci`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the root@ bootstrap script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jay/.npm/_logs/2021-03-16T00_27_52_288Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! root@ postinstall: `npm run bootstrap --no-ci && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the root@ postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jay/.npm/_logs/2021-03-16T00_27_52_413Z-debug.log

 ~/joplin ```

It looks like you're missing some native build dependencies. I have no experience with macOS so I can't say for sure what the issue is (some others on the forum will know better).

First of all, did you install the required dependencies?
If so, do you have Xcode installed? Your error above (gyp: No Xcode or CLT version detected!) suggests it isn't.

Yes, I installed Cocoapods, and i have Xcode installed as well

From your hint, I did a reset on the command-line tools using sudo xcode-select --reset, this fixed the initial errors, but now running npm install from the root directory returns a new set of errors

Error log


> root@ postinstall /Users/jay/joplin
> npm run bootstrap --no-ci && npm run build


> root@ bootstrap /Users/jay/joplin
> lerna bootstrap --no-ci

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Bootstrapping 15 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle @joplin/app-clipper@1.0.8~postinstall: @joplin/app-clipper@1.0.8
lerna info lifecycle @joplin/app-desktop@1.8.0~postinstall: @joplin/app-desktop@1.8.0
lerna info lifecycle @joplin/app-mobile@0.8.9~postinstall: @joplin/app-mobile@0.8.9

> @joplin/app-clipper@1.0.8 postinstall /Users/jay/joplin/packages/app-clipper
> cd popup && npm install


> fsevents@1.2.11 install /Users/jay/joplin/packages/app-clipper/popup/node_modules/jest-haste-map/node_modules/fsevents
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
In file included from ../../../../nan/nan.h:2884:
../../../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908.
      [-Wdeprecated-declarations]
      data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
                                          ^
/Users/jay/Library/Caches/node-gyp/14.16.0/include/node/v8.h:5272:3: note: 'GetContents' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
  ^
/Users/jay/Library/Caches/node-gyp/14.16.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                      ^
1 warning generated.
  SOLINK_MODULE(target) Release/fse.node

> fsevents@1.2.12 install /Users/jay/joplin/packages/app-clipper/popup/node_modules/react-scripts/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
In file included from ../../../../../../nan/nan.h:2884:
../../../../../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See
      http://crbug.com/v8/9908. [-Wdeprecated-declarations]
      data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
                                          ^
/Users/jay/Library/Caches/node-gyp/14.16.0/include/node/v8.h:5272:3: note: 'GetContents' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
  ^
/Users/jay/Library/Caches/node-gyp/14.16.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                      ^
1 warning generated.
  SOLINK_MODULE(target) Release/fse.node

> fsevents@1.2.11 install /Users/jay/joplin/packages/app-clipper/popup/node_modules/watchpack/node_modules/fsevents
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
In file included from ../../../../nan/nan.h:2884:
../../../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908.
      [-Wdeprecated-declarations]
      data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
                                          ^
/Users/jay/Library/Caches/node-gyp/14.16.0/include/node/v8.h:5272:3: note: 'GetContents' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
  ^
/Users/jay/Library/Caches/node-gyp/14.16.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                      ^
1 warning generated.
  SOLINK_MODULE(target) Release/fse.node

> fsevents@1.2.11 install /Users/jay/joplin/packages/app-clipper/popup/node_modules/webpack-dev-server/node_modules/fsevents
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
In file included from ../../../../nan/nan.h:2884:
../../../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908.
      [-Wdeprecated-declarations]
      data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
                                          ^
/Users/jay/Library/Caches/node-gyp/14.16.0/include/node/v8.h:5272:3: note: 'GetContents' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
  ^
/Users/jay/Library/Caches/node-gyp/14.16.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                      ^
1 warning generated.
  SOLINK_MODULE(target) Release/fse.node

> core-js@2.6.11 postinstall /Users/jay/joplin/packages/app-clipper/popup/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> core-js@3.6.4 postinstall /Users/jay/joplin/packages/app-clipper/popup/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.6.5 postinstall /Users/jay/joplin/packages/app-clipper/popup/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> joplin-webclipper-popup@0.1.0 postinstall /Users/jay/joplin/packages/app-clipper/popup
> node postinstall.js && npm run build


> joplin-webclipper-popup@0.1.0 build /Users/jay/joplin/packages/app-clipper/popup
> node scripts/build.js SKIP_PREFLIGHT_CHECK

Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run the following command: `npm update`
Compiled successfully.

File sizes after gzip:

  48.12 KB  build/static/js/2.chunk.js
  7.52 KB   build/static/js/main.chunk.js
  775 B     build/static/js/runtime-main.js
  746 B     build/static/css/main.chunk.css

The project was built assuming it is hosted at ./.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:

  bit.ly/CRA-deploy

npm WARN The package fs-extra is included as both a dev and production dependency.

added 2127 packages from 889 contributors and audited 2131 packages in 137.472s

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

found 8837 vulnerabilities (8778 low, 37 moderate, 22 high)
  run `npm audit fix` to fix them, or `npm audit` for details

> @joplin/app-desktop@1.8.0 postinstall /Users/jay/joplin/packages/app-desktop
> npm run build


> @joplin/app-desktop@1.8.0 build /Users/jay/joplin/packages/app-desktop
> gulp build

/Users/jay/joplin
[03:31:52] Using gulpfile ~/joplin/packages/app-desktop/gulpfile.js
[03:31:52] Starting 'build'...
[03:31:52] Starting 'compileScripts'...
[03:31:52] Starting 'compilePackageInfo'...
[03:31:52] Starting 'copyPluginAssets'...
[03:31:52] Starting 'copyTinyMceLangs'...
[03:31:52] Starting 'updateIgnoredTypeScriptBuild'...
Compiling /Users/jay/joplin/packages/app-desktop/tools/../gui/ClipperConfigScreen.jsx...

Error: spawnSync /Users/jay/joplin/packages/app-desktop/tools/../node_modules/.bin/babel ENOENT
    at Object.spawnSync (internal/child_process.js:1067:20)
    at spawnSync (child_process.js:602:24)
    at /Users/jay/joplin/packages/app-desktop/tools/compileScripts.js:31:19
    at Array.forEach (<anonymous>)
    at convertJsx (/Users/jay/joplin/packages/app-desktop/tools/compileScripts.js:17:23)
    at module.exports (/Users/jay/joplin/packages/app-desktop/tools/compileScripts.js:45:2)
    at compileScripts (/Users/jay/joplin/packages/app-desktop/node_modules/undertaker/lib/set-task.js:13:15)
    at bound (domain.js:413:15)
    at runBound (domain.js:424:12)
    at asyncRunner (/Users/jay/joplin/packages/app-desktop/node_modules/async-done/index.js:55:18) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync /Users/jay/joplin/packages/app-desktop/tools/../node_modules/.bin/babel',
  path: '/Users/jay/joplin/packages/app-desktop/tools/../node_modules/.bin/babel',
  spawnargs: [
    '--presets',
    'react',
    '--out-file',
    '/Users/jay/joplin/packages/app-desktop/tools/../gui/ClipperConfigScreen.min.js',
    '/Users/jay/joplin/packages/app-desktop/tools/../gui/ClipperConfigScreen.jsx'
  ]
}
[03:31:52] The following tasks did not complete: build, compileScripts, compilePackageInfo, copyPluginAssets, copyTinyMceLangs, updateIgnoredTypeScriptBuild
[03:31:52] Did you forget to signal async completion?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @joplin/app-desktop@1.8.0 build: `gulp build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @joplin/app-desktop@1.8.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jay/.npm/_logs/2021-03-16T02_31_52_998Z-debug.log
lerna info lifecycle @joplin/app-desktop@1.8.0~postinstall: Failed to exec postinstall script

> @joplin/app-mobile@0.8.9 postinstall /Users/jay/joplin/packages/app-mobile
> jetify && npm run build

sh: jetify: command not found
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! root@ bootstrap: `lerna bootstrap --no-ci`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the root@ bootstrap script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jay/.npm/_logs/2021-03-16T02_31_53_122Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! root@ postinstall: `npm run bootstrap --no-ci && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the root@ postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jay/.npm/_logs/2021-03-16T02_31_53_287Z-debug.log

Now it says this file does not exist
/Users/jay/joplin/packages/app-desktop/tools/../node_modules/.bin/babel

You can manually check if that is correct. What you can do now though is try deleting

/Users/jay/joplin/packages/app-desktop/node_modules/
and
/Users/jay/joplin/packages/app-desktop/package-lock.json

and then run npm install from /Users/jay/joplin/ again