npm ERR! code 1 npm ERR! path H:\nodejs\node_global\node_modules\windows-build-tools npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./dist/index.js Downloading python-2.7.15.amd64.msi npm ERR! [============================================>] 100.0% (0 B/s) npm ERR! Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\Administrator\.windows-build-tools\python-2.7.15.amd64.msi. Downloading vs_BuildTools.exe npm ERR! [============================================>] 100.0% (0 B/s) npm ERR! Downloaded vs_BuildTools.exe. Saved to C:\Users\Administrator\.windows-build-tools\vs_BuildTools.exe. npm ERR! npm ERR! Starting installation... npm ERR! Downloading installers failed. Error: TypeError: 'process.env' only accepts a configurable, writable, and enumerable data descriptor npm ERR! at Function.defineProperty (<anonymous>) npm ERR! at Object.removePath (H:\nodejs\node_global\node_modules\windows-build-tools\dist\utils\remove-path.js:11:12) npm ERR! at Object.install (H:\nodejs\node_global\node_modules\windows-build-tools\dist\install\index.js:29:19) npm ERR! at H:\nodejs\node_global\node_modules\windows-build-tools\dist\start.js:17:19 npm ERR! at Object.download (H:\nodejs\node_global\node_modules\windows-build-tools\dist\download.js:35:5) npm ERR! at process.processTicksAndRejections (node:internal/process/task_queues:95:5) npm ERR! at async Object.aquireInstallers (H:\nodejs\node_global\node_modules\windows-build-tools\dist\aquire-installers.js:32:13) { npm ERR! code: 'ERR_INVALID_OBJECT_DEFINE_PROPERTY' npm ERR! } npm ERR! windows-build-tools will now exit. npm ERR! A complete log of this run can be found in: H:\nodejs\node_cache\_logs\2023-05-16T16_45_09_212Z-debug-0.log PS C:\Windows\system32>
时间: 2023-06-19 20:10:53 浏览: 628
这是一个npm安装windows-build-tools时出现的错误。可能是因为环境变量process.env被设置为不可写。你可以尝试以下步骤来解决这个问题:
1. 确认你的npm版本是否最新,如果不是,请更新npm。
2. 运行命令`npm cache clean --force`清除npm缓存。
3. 以管理员身份运行命令提示符或PowerShell。
4. 运行命令`npm install --global windows-build-tools`重新安装windows-build-tools。
如果这些步骤都无法解决问题,可能需要考虑更改环境变量process.env的配置。
相关问题
npm ERR! code 1 npm ERR! path H:\nodejs\node_global\node_modules\windows-build-tools npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./dist/index.js Downloading python-2.7.15.amd64.msi npm ERR! [============================================>] 100.0% of 20.2 MB (20.2 MB/s) npm ERR! Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\Administrator\.windows-build-tools\python-2.7.15.amd64.msi. Downloading vs_BuildTools.exe npm ERR! [============================================>] 100.0% of 1.12 MB (1.12 MB/s) npm ERR! Downloaded vs_BuildTools.exe. Saved to C:\Users\Administrator\.windows-build-tools\vs_BuildTools.exe. npm ERR! npm ERR! Starting installation... npm ERR! Downloading installers failed. Error: TypeError: 'process.env' only accepts a configurable, writable, and enumerable data descriptor npm ERR! at Function.defineProperty (<anonymous>) npm ERR! at Object.removePath (H:\nodejs\node_global\node_modules\windows-build-tools\dist\utils\remove-path.js:11:12) npm ERR! at Object.install (H:\nodejs\node_global\node_modules\windows-build-tools\dist\install\index.js:29:19) npm ERR! at H:\nodejs\node_global\node_modules\windows-build-tools\dist\start.js:17:19 npm ERR! at Object.download (H:\nodejs\node_global\node_modules\windows-build-tools\dist\download.js:35:5) npm ERR! at process.processTicksAndRejections (node:internal/process/task_queues:95:5) npm ERR! at async Object.aquireInstallers (H:\nodejs\node_global\node_modules\windows-build-tools\dist\aquire-installers.js:32:13) { npm ERR! code: 'ERR_INVALID_OBJECT_DEFINE_PROPERTY' npm ERR! } npm ERR! windows-build-tools will now exit. npm ERR! A complete log of this run can be found in: H:\nodejs\node_cache\_logs\2023-05-16T16_40_51_589Z-debug-0.log
这个错误可能是由于安装 windows-build-tools 时出现了问题。建议尝试以下步骤:
1. 确保已经安装了 Python 和 Visual Studio Build Tools。可以尝试手动下载安装并设置环境变量。
2. 尝试以管理员身份运行命令提示符窗口,并重新安装 windows-build-tools。
3. 如果还是无法解决问题,可以考虑尝试使用其他的构建工具或者手动编译所需的模块。
npm ERR! code 1 npm ERR! path H:\nodejs\node_global\node_modules\opencv4nodejs npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./install/install.js npm ERR! info install using lib dir: H:/nodejs/node_global/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/lib/Release npm ERR! H:\nodejs\node_global\node_modules\opencv4nodejs\install\install.js:37 npm ERR! throw new Error('library dir does not exist: ' + libDir) npm ERR! ^ npm ERR! npm ERR! Error: library dir does not exist: H:/nodejs/node_global/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/lib/Release npm ERR! at Object.<anonymous> (H:\nodejs\node_global\node_modules\opencv4nodejs\install\install.js:37:9) npm ERR! at Module._compile (node:internal/modules/cjs/loader:1254:14) npm ERR! at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) npm ERR! at Module.load (node:internal/modules/cjs/loader:1117:32) npm ERR! at Module._load (node:internal/modules/cjs/loader:958:12) npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) npm ERR! at node:internal/main/run_main_module:23:47 npm ERR! npm ERR! Node.js v18.16.0 npm ERR! A complete log of this run can be found in: npm ERR! H:\nodejs\node_cache\_logs\2023-05-15T14_20_39_899Z-debug-0.log
这个错误提示是在安装 opencv4nodejs 模块时出现的,可能是由于 opencv-build 模块未正确安装导致的。你可以尝试以下步骤来解决这个问题:
1. 确认你的环境中已经安装了 Python 和 C++ 编译工具。
2. 删除 node_modules 目录和 package-lock.json 文件,重新执行 `npm install` 命令。
3. 如果上述步骤仍然无法解决问题,可以尝试手动安装 opencv-build 模块。执行以下命令:
```
npm install --save-dev opencv-build
```
4. 然后再次尝试安装 opencv4nodejs 模块。执行以下命令:
```
npm install opencv4nodejs
```
希望这些步骤能够解决你的问题。
阅读全文