microsoft / vscode-mock-debug

Starter sample for developing debug adapters for VSCode.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

You installed esbuild on another platform than the one you're currently using.

MitchK opened this issue · comments

To reproduce:

Could the issue be that VSCode is running a different node version?

I get this output below:

> Executing task: yarn run watch <

yarn run v1.22.18
warning mock-debug@0.51.0: The engine "vscode" appears to be invalid.
$ npm run -S esbuild-base -- --sourcemap --sources-content=false --watch
npm WARN lifecycle The node binary used for scripts is /var/folders/ft/v4gkgn3x5_z6qr0m28p15htw0000gp/T/yarn--1658792157214-0.43111544680776226/node but npm is using /Users/mkunzmann/.nvm/versions/node/v12.20.1/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> mock-debug@0.51.0 esbuild-base /Users/mkunzmann/gitlab.com/rivian/me/factory-systems/rockwell/vscode-mock-debug
> esbuild ./src/extension.ts --bundle --tsconfig=./tsconfig.json --external:vscode --format=cjs --platform=node --outfile=dist/extension.js "--sourcemap" "--sources-content=false" "--watch"

/Users/mkunzmann/gitlab.com/rivian/me/factory-systems/rockwell/vscode-mock-debug/node_modules/esbuild/bin/esbuild:112
          throw new Error(`
          ^

Error: 
You installed esbuild on another platform than the one you're currently using.
This won't work because esbuild is written with native code and needs to
install a platform-specific binary executable.

Specifically the "esbuild-darwin-arm64" package is present but this platform
needs the "esbuild-darwin-64" package instead. People often get into this
situation by installing esbuild on Windows or macOS and copying "node_modules"
into a Docker image that runs Linux, or by copying "node_modules" between
Windows and WSL environments.

If you are installing with npm, you can try not copying the "node_modules"
directory when you copy the files over, and running "npm ci" or "npm install"
on the destination platform after the copy. Or you could consider using yarn
instead which has built-in support for installing a package on multiple
platforms simultaneously.

If you are installing with yarn, you can try listing both this platform and the
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
Keep in mind that this means multiple copies of esbuild will be present.

Another alternative is to use the "esbuild-wasm" package instead, which works
the same way on all platforms. But it comes with a heavy performance cost and
can sometimes be 10x slower than the "esbuild" package, so you may also not
want to do that.

    at generateBinPath (/Users/mkunzmann/gitlab.com/rivian/me/factory-systems/rockwell/vscode-mock-debug/node_modules/esbuild/bin/esbuild:112:17)
    at Object.<anonymous> (/Users/mkunzmann/gitlab.com/rivian/me/factory-systems/rockwell/vscode-mock-debug/node_modules/esbuild/bin/esbuild:168:27)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mock-debug@0.51.0 esbuild-base: `esbuild ./src/extension.ts --bundle --tsconfig=./tsconfig.json --external:vscode --format=cjs --platform=node --outfile=dist/extension.js "--sourcemap" "--sources-content=false" "--watch"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mock-debug@0.51.0 esbuild-base 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/mkunzmann/.npm/_logs/2022-07-25T23_35_58_194Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The terminal process "/bin/zsh '-c', 'yarn run watch'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Cannot reproduce.

I was experiencing the same. I changed my node version (using nvm) in the vscode terminal before running yarn, but when the new vscode window was opened it was using the previous (different) version.
Once that was fixed, I was able to correctly run the extension in debug mode.