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: Failed to link ***: EPERM on Windows #13659

Open
CosmoMyzrailGorynych opened this issue Sep 1, 2024 · 5 comments
Open

error: Failed to link ***: EPERM on Windows #13659

CosmoMyzrailGorynych opened this issue Sep 1, 2024 · 5 comments
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client windows An issue that is known to occur on Windows

Comments

@CosmoMyzrailGorynych
Copy link

CosmoMyzrailGorynych commented Sep 1, 2024

What version of Bun is running?

1.1.26 0a37423ba

What platform is your computer?

Microsoft Windows NT 10.0.22621.0 x64

What steps can reproduce the bug?

Oh, if only I knew.

What is the expected behavior?

bun install must install packages without errors.

What do you see instead?

Any time I run bun install (in any project but here is one example), I get dozens of Failed to link X: EPERM:

$ bun install
bun install v1.1.26 (0a37423b)
error: Failed to link @capacitor/cli: EPERM

error: Failed to link @electron/asar: EPERM

error: Failed to link @neutralinojs/neu: EPERM

error: Failed to link JSONStream: EPERM

error: Failed to link acorn: EPERM

error: Failed to link browserslist: EPERM

error: Failed to link conventional-changelog-writer: EPERM      

error: Failed to link conventional-commits-parser: EPERM        

error: Failed to link cssesc: EPERM

error: Failed to link get-pkg-repo: EPERM

error: Failed to link git-raw-commits: EPERM

error: Failed to link git-semver-tags: EPERM

error: Failed to link gradle-to-js: EPERM

error: Failed to link handlebars: EPERM

error: Failed to link is-docker: EPERM

error: Failed to link js-yaml: EPERM

error: Failed to link mkdirp: EPERM

error: Failed to link nanoid: EPERM

error: Failed to link native-run: EPERM

error: Failed to link node-gyp-build: EPERM

error: Failed to link nodemon: EPERM

error: Failed to link npm-watch: EPERM

error: Failed to link prettier: EPERM

error: Failed to link replace: EPERM

error: Failed to link resedit-cli: EPERM

error: Failed to link resolve: EPERM

error: Failed to link rimraf: EPERM

error: Failed to link seek-bzip: EPERM

error: Failed to link semver: EPERM

error: Failed to link svgo: EPERM

error: Failed to link touch: EPERM

error: Failed to link tree-kill: EPERM

error: Failed to link ts-node: EPERM

error: Failed to link ttf2woff: EPERM

error: Failed to link typescript: EPERM

error: Failed to link uglify-js: EPERM

error: Failed to link update-browserslist-db: EPERM

error: Failed to link uuid: EPERM

error: Failed to link which: EPERM

error: Failed to link xml-js: EPERM

error: Failed to link uuid: EPERM

error: Failed to link semver: EPERM

error: Failed to link semver: EPERM

error: Failed to link rimraf: EPERM

error: Failed to link semver: EPERM

error: Failed to link semver: EPERM

error: Failed to link semver: EPERM

error: Failed to link semver: EPERM

error: Failed to link semver: EPERM

I've attempted:

  • rebooting,
  • nuking package cache at C:\Users\Comigo\.bun\install\cache,
  • nuking node_modules folder in my project,
  • nuking them both and trying bun install
  • reinstalling bun,
  • deleting and then installing bun,

all to no avail. I cannot continue working on my project.
I never run bun as admin. I also don't understand why the linking when all these packages are not installed globally, and some of them are dependencies.

Additional information

My package.json:

{
    "name": "backend",
    "module": "index.ts",
    "type": "module",
    "dependencies": {
        "@capacitor/cli": "^5.5.0",
        "@capacitor/core": "^5.5.0",
        "@neutralinojs/neu": "^11.2.0",
        "@trapezedev/project": "^7.0.10",
        "@types/html-minifier-terser": "^7.0.2",
        "@types/ttf2woff": "^2.0.4",
        "cssnano": "^7.0.5",
        "htmlfy": "^0.2.1",
        "resedit-cli": "^2.0.0",
        "ttf2woff": "^3.0.0",
        "zip-lib": "^1.0.4"
    },
    "devDependencies": {
        "@types/bun": "latest"
    },
    "peerDependencies": {
        "typescript": "^5.0.0"
    }
}
@CosmoMyzrailGorynych CosmoMyzrailGorynych added bug Something isn't working needs triage labels Sep 1, 2024
@CosmoMyzrailGorynych
Copy link
Author

CosmoMyzrailGorynych commented Sep 1, 2024

Alright, this is my antivirus killing everything in project folder's node_modules/.bin, but why the heck Bun creates metadata-less .exe files? Of course it will be slaughtered by every antivirus. What's wrong with .ps1 files?

I don't want to disable my antivirus just for that because I work on my projects almost daily.

@Jarred-Sumner
Copy link
Collaborator

but why the heck Bun creates metadata-less .exe files? What's wrong with .ps1 files?

@paperdave when are you writing a blog post on your talk about this

@paperdave paperdave added windows An issue that is known to occur on Windows and removed needs triage labels Sep 1, 2024
@paperdave
Copy link
Collaborator

Of course it will be slaughtered by every antivirus.

this is the second case i've seen anyone report this exe flagged. what anti virus software is it? i'd like to do some work later to make sure this is not the case going forward.

you can add the exe's hash to a whitelist, but due to #12738, the hash of that exe is not currently consistent and would have to be re-applied on every upgrade. that would be the first step to solving this issue.

when are you writing a blog post on your talk about this

not sure, as i'm spending most of my time on #13215. writing an entire blog post on this is not a priority.

What's wrong with .ps1 files?

  • starting a .ps1 script from outside powershell is extremely slow (hundreds of milliseconds)
  • starting a .cmd script in any form makes control c signals show an additional dialog Terminate batch job

the exe variant of this shim is the highest quality experience, and the proper solution is to figure out what stops anti-virus software. for what it's worth, we could add cmd/ps1 fallbacks for when this fails, but i don't think that workaround is a good idea.

in addition, there is not enough error handling in bun install to say what part of the installation hit EPERM (error: Failed to link package-name: EPERM). the error should say that it failed to create the bin link, the error it encountered while doing so, and then supplimentary text about it possibly being taken from an anti-virus.

@paperdave paperdave added the bun install Something that relates to the npm-compatible client label Sep 1, 2024
@CosmoMyzrailGorynych
Copy link
Author

CosmoMyzrailGorynych commented Sep 5, 2024

what anti virus software is it?

360 Total Security. The files are marked as generic Trojans.

@ojvribeiro
Copy link

It seems to be a problem with Malwarebytes as well, all .exe files created by Bun (including my own lib) are nuked by it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client windows An issue that is known to occur on Windows
Projects
None yet
Development

No branches or pull requests

4 participants