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

🐛 [Bug]: 执行 pnpm i 报错 #1293

Closed
mengqiuleo opened this issue Jan 12, 2024 · 1 comment
Closed

🐛 [Bug]: 执行 pnpm i 报错 #1293

mengqiuleo opened this issue Jan 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mengqiuleo
Copy link
Collaborator

Version

latest

Vue Version

latest

Link to minimal reproduction

error

Step to reproduce

执行pnpm i失败,应该是 pnpm 版本问题,目前 package.json 中 "packageManager": "pnpm@7.11.0"

packageManager 属性需要 corepack 配合,当本地的 corepack 启用( 执行corepack enable )时,pnpm i报错

报错信息: ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/packagename: Value of "this" must be of type URLSearchParams

这个问题的根本原因在于pnpm模块依赖的node-fetch库中,URLSearchParams.prototype[p].call()函数调用时,错误地把this上下文设置为了receiver(代理对象)而非target(原始对象)。将this上下文设置为receiver导致URLSearchParams的方法无法正确访问原始对象的属性和方法,进而抛出ERR_INVALID_THIS异常。官方链接:"ERR_INVALID_THIS" on "pnpm up" in Node 20

此时需要将 pnpm 版本 >= 8.3.1

What is expected

No response

What is actually happening

No response

Any additional comments (optional)

No response

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: 🐛 [Bug]: Execute pnpm i and report an error

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

3 participants