Warnings on esbuild when doing `npm run dev` on Mac

So, I’ve just cloned the obsidian-sample-plugin on github, and clone it into my test vault, and I run npm i succesfully, but having trouble doing the npm run dev command.

In an attempt to fix it, I’ve also run npm install eslint, npm install obsidian, npm install codemirror (and tried npm install --save-exact esbuild and npm install esbuild) one after another, but still when I run npm run dev I’m getting the following error message:

minimac:obsidian-source-code-sync$ npm run dev

> [email protected] dev /Volumes/Local/tmp/Sandkasse/.obsidian/plugins/obsidian-source-code-sync
> node esbuild.config.mjs

/Volumes/Local/tmp/Sandkasse/.obsidian/plugins/obsidian-source-code-sync/esbuild.config.mjs:1
(function (exports, require, module, __filename, __dirname) { import esbuild from "esbuild";
                                                                     ^^^^^^^

SyntaxError: Unexpected identifier
    at new Script (vm.js:83:7)
    at createScript (vm.js:267:10)
    at Object.runInThisContext (vm.js:319:10)
    at Module._compile (internal/modules/cjs/loader.js:686:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:776:12)
    at executeUserCode (internal/bootstrap/node.js:342:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `node esbuild.config.mjs`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] dev 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/USERNAME/.npm/_logs/2022-12-25T18_02_41_739Z-debug.log

Is there something else I should have done before doing the npm run dev, or is there something else wrong with my setup?

I’m kind of stuck, when the base sample plugin don’t get to compile before I’ve even made any changes to it. Is there any other information you would like for me to provide in order to solve this situation?

Various other stuff I’ve tried:

  • npm --version → 6.4.1
  • ./node_modules/.bin/esbuild --version → 0.14.54

PS! I do know coding, and my way around in the terminal, but I’m a bit rusty with regards to git/github/npm stuff…

So whilst fumbling along, I thought I should look into my node.js version, and I think it was 11.4.0, at least when I did the following:

minimac:obsidian-source-code-sync USERNAME$ sudo n stable
Password:

     install : node-v19.2.0
       mkdir : /usr/local/n/versions/node/19.2.0
       fetch : https://nodejs.org/dist/v19.2.0/node-v19.2.0-darwin-x64.tar.gz
tar: Failed to set default locale
######################################################################## 100.0%
   installed : v19.2.0

minimac:obsidian-source-code-sync USERNAME$ npm run dev

> [email protected] dev
> node esbuild.config.mjs

[watch] build finished, watching for changes...

^C

It seems like it’s happy. Is the npm run dev supposed to be run in the background, or constantly running?