Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: The package "@esbuild/darwin-arm64" could not be found, and is needed by esbuild. #35

Open
kurtextrem opened this issue Dec 17, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@kurtextrem
Copy link

I get the "Error: The package "@esbuild/darwin-arm64" could not be found, and is needed by esbuild." error (thrown in the tsslint.config.ts file on the first line at import when trying to set up tsslint in a repo managed by Yarn.

This is my package:

 "dependencies": {
        "@esbuild/darwin-arm64": "0.17.19",
        "esbuild": "^0.17.19",
        "@tsslint/config": "^1.4.6",
        "@tsslint/eslint": "^1.4.6",

I can also clearly see it in my node_modules:
image

And I also tried running npm -g i esbuild, which didn't resolve the issue either. Where is tsslint trying to load esbuild from? My VSC workspace is the root (e.g. where package.json and tsslint.config.ts are).

TSSLint VSC version: 1.4.6

@johnsoncodehk
Copy link
Owner

Where did you see this error? TSSLint extension does not use esbuild in your project. When the extension is started for the first time, it will run node_modules/esbuild/install.js in the TSSLint extension directory, and then install @esbuild/darwin-arm64 to the node_modules of TSSLint extension directory through npm install.

Maybe you have a corrupt @esbuild/darwin-arm64 installed for some reason, please try if this solves the problem.

  1. Uninstall TSSLint extension.
  2. Close VSCode completely. (Make sure VSCode clears uninstalled extensions)
  3. Open VSCode and reinstall the TSSLint extension. The esbuild installation should now be performed again.

@kurtextrem
Copy link
Author

Did that - didn't fix it:
image

@kurtextrem
Copy link
Author

Interesting, when I do it manually in the install folder, I get this:

node node_modules/esbuild/install.js
[esbuild] Failed to find package "@esbuild/darwin-arm64" on the file system

This can happen if you use the "--no-optional" flag. The "optionalDependencies"
package.json feature is used by esbuild to install the correct binary executable
for your current platform. This install script will now attempt to work around
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.

[esbuild] Trying to install package "@esbuild/darwin-arm64" using npm

and no other log. It doesn't install it. Manually doing npm i @esbuild/darwin-arm64 works.

@johnsoncodehk
Copy link
Owner

johnsoncodehk commented Dec 17, 2024

  1. What is the size of this file?
    • ~/.vscode/extensions/johnsoncodehk.vscode-tsslint-1.4.6/node_modules/esbuild/bin/esbuild
  2. Do these two files exist?
    • ~/.vscode/extensions/johnsoncodehk.vscode-tsslint-1.4.6/node_modules/esbuild/lib/downloaded-@esbuild-darwin-arm64-esbuild
    • ~/.vscode/extensions/johnsoncodehk.vscode-tsslint-1.4.6/node_modules/esbuild/install.js

@johnsoncodehk
Copy link
Owner

johnsoncodehk commented Dec 17, 2024

I currently have no idea about this problem. This is the extension installation package with built-in @esbuild/darwin-arm64 (use VSCode "Developer: Install Extension from Location..." command to install)

vscode-tsslint-1.4.6 (@esbuild/darwin-arm64).vsix.zip

If you have any clues please let me know, thanks.

@kurtextrem
Copy link
Author

I wonder if my node version manager breaks this mechanism or something.
Running npm i @esbuild/darwin-arm64 from CLI works as expected in that folder (and then also makes tsslint work)

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants