题意:错误:TypeError: 'process.env' 只接受一个可配置的值,安装 windows-build-tools 时出现问题

问题背景:

Downloading installers failed. Error: TypeError: 'process.env' only accepts a configurable, writable, and enumerable data descriptor.

下载安装程序失败。错误:TypeError: 'process.env' 仅接受可配置的、可写的和可枚举的数据描述符。

I have run this command npm install --global windows-build-tools

我运行了这个命令 npm install --global windows-build-tools

Node version : v18.12.0 NPM version : 8.19

问题解决:

I had the exact same problem. First I tried to do npm install --global --production windows-build-tools@4.0.0  but didn't work then npm config set msvs_version 2022 but still didn't work.

我遇到了完全相同的问题。首先我尝试了 npm install --global --production windows-build-tools@4.0.0,但是没有成功;然后我尝试了 npm config set msvs_version 2022,但还是不行。

Finally I tried to download node version 17.9.1 and retried the command and it worked!!

最后我尝试下载了 Node 版本 17.9.1,并重新运行了命令,结果成功了!!

So here are the steps:        

所以这是步骤:

Step 1: uninstall Node version 18.12 and install version 17.9.1 

步骤 1:卸载 Node 版本 18.12 并安装版本 17.9.1

Step 2: Search %temp% under window search bar (Copy %temp% then press windows button + Ctrl V)    步骤 2:在 Windows 搜索栏中搜索 %temp%(复制 %temp% 然后按 Windows 键 + Ctrl V)

Step 3: Create 'dd_client_.log.txt' and enter 'Closing installer. Return code: 3010.' 

步骤 3:创建 'dd_client_.log.txt' 并输入 'Closing installer. Return code: 3010.'

after that you should be able to finish the whole process with npm install --global windows-build-tools

之后,你应该能够通过 npm install --global windows-build-tools 完成整个过程。

big thanks to 非常感谢 seantsang

Between I have no Idea if the technique of seantsang work directly when installing windows-build-tools with node.js version 18.12 . If what I said didn't help, maybe try 

顺便说一下,我不确定在安装 windows-build-tools 时,seantsang 的方法是否直接适用于 Node.js 版本 18.12。如果我说的没有帮助,也许可以尝试 this

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐