fwouts/previewjs

error 'The package "esbuild-windows-32" could not be found,....'

NathanKr opened this issue · 2 comments

Describe the bug

I am getting an error 'The package "esbuild-windows-32" could not be found,....' when I try to see the component preview

Reproduction

Open vs code for https://github.com/NathanKr/react-draw-events
Navigate to https://github.com/NathanKr/react-draw-events/blob/main/src/components/Events.jsx
Put the cursor inside the component
Click the icon 'Open preview'
see the error : 'The package "esbuild-windows-32" could not be found,....'

Preview.js version

v1.1.0

System Info

System:
    OS: Windows 10 10.0.19042
    CPU: (4) x64 Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz
    Memory: 2.42 GB / 7.89 GB
  Binaries:
    Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    VSCode: 1.64.2 - C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
    Visual Studio: 16.11.31624.102 (Visual Studio Community 2019)
  Browsers:
    Chrome: 98.0.4758.102
    Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.56)
    Internet Explorer: 11.0.19041.1202

Used Package Manager

npm

Extension logs (useful for crashes)

No response

Preview logs (useful for rendering errors)

No response

Anything else?

Untitled

Hi @NathanKr, thank you for the bug report.

It looks like somehow your VS Code thinks it's running on Windows in 32 bit mode. This error comes from esbuild, and you can see their logic here: https://github.com/evanw/esbuild/blob/bf341f7104b373d85061c31ebb00efc6f9a8bf5a/lib/npm/node-platform.ts. In particular, it looks like within your version of VS Code, ${process.platform} ${os.arch()} ${os.endianness()} returns ' 'win32 ia32 LE': 'esbuild-windows-32'.

I wonder if you might be using the wrong version of VS Code? You'd want to use the 64 bit user installer from https://code.visualstudio.com/download to replace your current version.

It's also entirely possible that my diagnostic is wrong, just let me know as it will help figure out the next steps to debug this :)

I'm closing this as you haven't responded, feel free to reopen if you do :)