oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.53k stars 2.79k forks source link

`bun install` fails on Windows: Operation not permitted (NtSetInformationFile()) #11250

Open bamf2077 opened 6 months ago

bamf2077 commented 6 months ago

What version of Bun is running?

1.1.9+bb13798d9

What platform is your computer?

Microsoft Windows NT 10.0.22621.0 x64

What steps can reproduce the bug?

bun install oxlint

What is the expected behavior?

Installed oxlint successfully.

What do you see instead?

bun add v1.1.9 (bb13798d)
  🚚 @oxlint/win32-x64 [2/2] error: InstallFailed extracting tarball for @oxlint/win32-x64
error: moving "@oxlint/win32-x64" to cache dir failed
EPERM: Operation not permitted (NtSetInformationFile())
  From: .1ffdbfffec475ade-00000001.win32-x64
    To: @oxlint/win32-x64@0.3.5@@mirrors.cloud.tencent.com

Additional information

This issuse seems to be the same as #9830?

At first I thought it was a problem with the mirror registry provided by Tencent (https://mirrors.cloud.tencent.com/npm/), because the installation succeed after I switched to another mirror registry (https://mirrors.huaweicloud.com/repository/npm/). However, after downloading two archive files and comparing checksums, the hashes were the same.

https://mirrors.cloud.tencent.com/npm/@oxlint/win32-x64/-/win32-x64-0.3.5.tgz https://mirrors.huaweicloud.com/repository/npm/@oxlint/win32-x64/-/win32-x64-0.3.5.tgz

I also tried Yarn and pnpm, the installations with this mirror registry both worked.

bamf2077 commented 6 months ago

After I cleanup the global cache dir (~/.bun/install/cache), all these registries failed, I'm confused...

Jarred-Sumner commented 6 months ago

@bamf2077 does your computer have permission to access ~/.bun/install/cache?

bamf2077 commented 6 months ago

@bamf2077 does your computer have permission to access ~/.bun/install/cache?

yes, installation only fails on oxlint

$ bun install prettier eslint
bun add v1.1.9 (bb13798d)

installed prettier@3.2.5 with binaries:
 - prettier
installed eslint@9.3.0 with binaries:
 - eslint

90 packages installed [89.81s]
Jarred-Sumner commented 6 months ago

@bamf2077 can you check with a scoped package? i'm wondering if there's a bug specific to scoped packages, or if there's something interesting about oxlint's tarball

bamf2077 commented 6 months ago

@Jarred-Sumner

$ bun install @esbuild/win32-x64 @eslint/js @vue/eslint-config-typescript
bun add v1.1.9 (bb13798d)

installed @esbuild/win32-x64@0.21.3
installed @eslint/js@9.3.0
installed @vue/eslint-config-typescript@13.0.0

138 packages installed [13.92s]

$ bun install oxlint
bun add v1.1.9 (bb13798d)
  🚚 @oxlint/win32-x64 [22/22] error: InstallFailed extracting tarball for @oxlint/win32-x64
error: moving "@oxlint/win32-x64" to cache dir failed
EPERM: Operation not permitted (NtSetInformationFile())
  From: .d7d5f77fff6eeff8-00000002.win32-x64
    To: @oxlint/win32-x64@0.3.5@@mirrors.cloud.tencent.com

$ bun install @oxlint/win32-x64
bun add v1.1.9 (bb13798d)
  🚚 @oxlint/win32-x64 [2/2] error: InstallFailed extracting tarball for @oxlint/win32-x64
error: moving "@oxlint/win32-x64" to cache dir failed
EPERM: Operation not permitted (NtSetInformationFile())
  From: .b7f1ff85ff2ffff1-00000001.win32-x64
    To: @oxlint/win32-x64@0.3.5@@mirrors.cloud.tencent.com

Currently it seems that only @oxlint/win32-x64 will throw this error.

bamf2077 commented 6 months ago

I made some more test:

Case 1: Delete cache dir, run bun install in another repo, which includes oxlint as a devDependency.

package.json content:

{
"dependencies": {
    "@dcloudio/uni-app": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-app-plus": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-components": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-h5": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-alipay": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-baidu": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-jd": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-lark": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-qq": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-toutiao": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-weixin": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-mp-xhs": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4010720240511003",
    "@tencentcloud/chat-uikit-wechat": "^2.0.6",
    "lodash": "^4.17.21",
    "nanoid": "^5.0.7",
    "uuid": "^9.0.1",
    "vue": "3.4.21",
    "vue-i18n": "^9.13.1",
    "weixin-js-sdk": "^1.6.5"
  },
  "devDependencies": {
    "@dcloudio/types": "^3.4.8",
    "@dcloudio/uni-automator": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-cli-shared": "3.0.0-alpha-4010720240511003",
    "@dcloudio/uni-stacktracey": "3.0.0-alpha-4010720240511003",
    "@dcloudio/vite-plugin-uni": "3.0.0-alpha-4010720240511003",
    "@eslint/eslintrc": "^3.1.0",
    "@eslint/js": "^9.3.0",
    "@types/lodash": "^4.17.4",
    "@types/uuid": "^9.0.8",
    "@uni-helper/uni-app-types": "^0.5.13",
    "@vue/eslint-config-prettier": "^9.0.0",
    "@vue/eslint-config-typescript": "^13.0.0",
    "@vue/runtime-core": "^3.4.27",
    "@vue/tsconfig": "^0.5.1",
    "eslint": "^8.57.0",
    "eslint-plugin-oxlint": "^0.3.0",
    "eslint-plugin-vue": "^9.26.0",
    "globals": "^15.3.0",
    "husky": "^9.0.11",
    "lint-staged": "^15.2.4",
    "oxlint": "^0.3.5",
    "prettier": "^3.2.5",
    "sass": "^1.77.2",
    "typescript": "^5.4.5",
    "vite": "^5.2.11"
  }
}
$ bun install
bun install v1.1.9 (bb13798d)

+ @dcloudio/types@3.4.8
+ @dcloudio/uni-automator@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-cli-shared@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-stacktracey@3.0.0-alpha-4010720240511003
+ @dcloudio/vite-plugin-uni@3.0.0-alpha-4010720240511003
+ @eslint/eslintrc@3.1.0
+ @eslint/js@9.3.0
+ @types/lodash@4.17.4
+ @types/uuid@9.0.8
+ @uni-helper/uni-app-types@0.5.13
+ @vue/eslint-config-prettier@9.0.0
+ @vue/eslint-config-typescript@13.0.0
+ @vue/runtime-core@3.4.27
+ @vue/tsconfig@0.5.1
+ eslint@8.57.0
+ eslint-plugin-oxlint@0.3.0
+ eslint-plugin-vue@9.26.0
+ globals@15.3.0
+ husky@9.0.11
+ lint-staged@15.2.4
+ oxlint@0.3.5
+ prettier@3.2.5
+ sass@1.77.2
+ typescript@5.4.5
+ vite@5.2.11
+ @dcloudio/uni-app@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-app-plus@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-components@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-h5@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-alipay@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-baidu@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-jd@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-kuaishou@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-lark@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-qq@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-toutiao@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-weixin@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-mp-xhs@3.0.0-alpha-4010720240511003
+ @dcloudio/uni-quickapp-webview@3.0.0-alpha-4010720240511003
+ @tencentcloud/chat-uikit-wechat@2.0.6
+ lodash@4.17.21
+ nanoid@5.0.7
+ uuid@9.0.1
+ vue@3.4.21
+ vue-i18n@9.13.1
+ weixin-js-sdk@1.6.5

884 packages installed [5.64s]

Blocked 1 postinstall. Run `bun pm untrusted` for details.

Case 2: Delete cache dir, create a new folder, run bun install oxlint in this folder.

$ bun install oxlint
bun add v1.1.9 (bb13798d)
  🚚 @oxlint/win32-x64 [22/22] error: InstallFailed extracting tarball for @oxlint/win32-x64
error: moving "@oxlint/win32-x64" to cache dir failed
EPERM: Operation not permitted (NtSetInformationFile())
  From: .b7d1f7bcef8ffdbe-00000002.win32-x64
    To: @oxlint/win32-x64@0.3.5@@mirrors.cloud.tencent.com

This is really confusing.

sukeshpabolu commented 6 months ago

I am also facing similar issue especially after I updated bun to v1.1.9

stfnwp commented 5 months ago

I faced a similar issue using bun 1.1.15:

error: moving "@cucumber/cucumber" to cache dir failed
EPERM: Operation not permitted (NtSetInformationFile())
  From: .97dbdfbedf7ff9c0-00000002.cucumber
    To: @cucumber/cucumber@9.1.2@@@1

error: InstallFailed extracting tarball from @cucumber/cucumber

I solved it by manually removing the write-protection of folder .bun\install\cache\@cucumber in Windows Explorer. Obviously this is a bit cumbersome, so I would appreciate if this works without manual intervention.

sabreu-teknorix commented 4 months ago

I am getting a similar error

bun install v1.1.20 (ae194892)
error: moving "typescript" to cache dir failed
EPERM: Operation not permitted (NtSetInformationFile())
  From: .9fef99f9bbfec5e6-00000001.typescript
    To: typescript@5.5.3@@@1

error: InstallFailed extracting tarball from typescript

Note: Works on non-domain accounts

vitostamatti commented 3 months ago

Has someone found a fix for this?