使用缓存管理器,尽你之能力(Cache Me if You Can: Using the NT Cache Manager )

本文深入探讨了缓存管理器在NT内存管理中的核心功能,包括其如何优化物理内存使用,平衡文件缓存与系统程序运行。详细解释了缓存管理器的数据结构,如BufferControlBlock(BCB),以及如何通过缓存管理器回调函数与文件系统进行交互。同时,介绍了如何通过维护文件大小信息、实现缓存管理器回调来确保资源的有序获取,避免死锁。

在pediy.com发了一篇译文,简单转载这里。

缓存管理器属于NT内存管理器紧密集成的软件组件,与虚拟内存系统集成文件系统缓存数据。

好处是物理内存的使用和文件缓存和系统运行程序在缓存管理器下达到均衡应用。

另一个使用缓存关键原因是文件可被标准文件系统接口存取,如read和write等。或通过内存管理器形成一个“内存映射”文件。

缓存管理器数据结构:下段描述文件系统和缓存管理器共享的数据结构。

Buffer Control Bloxk (BCB)

Most of the buffer control block (BCB) is opaque. The first portion of the BCB is exposed to file systems:

typedef struct _PUBLIC_BCB {
    CSHORT NodeTypeCode;
    CSHORT NodeByteSize;
    ULONG MappedLength;
    LARGE_INTEGER MappedFileOffset;
} PUBLIC_BCB, *PPUBLIC_BCB;

 

Buffer控制块(BCB)

BCB用来跟踪文件,当此文件影射到系统地址空间。在文件系统在内存锁定(Pin)数据以作关键操作。结构后两个字段是指定了此BCB文件管理的范围。

File Size Information

The file system and Memory Manager each maintain information about the size of the file. Whenever the file system establishes mapping for a file it indicates the current size of the file. Any subsequent changes to the size of the file are similarly indicated to the Cache Manager.

文件系统和内存管理维护文件大小信息。所有后续文件大小改动都同样被cache manager显示处理。

There are three values used by the Cache Manager to indicate the current size of the file:

typedef struct _CC_FILE_SIZES {
    LARGE_INTEGER AllocationSize;
    LARGE_INTEGER FileSize;
    LARGE_INTEGER ValidDataLength;
} CC_FILE_SIZES, *PCC_FILE_SIZES;

AllocationSize段并非实际文件实际分配的物理空间。而是适于分配空间的数据量。

AllocationSize被内存管理器代表"section object"的大小。Section object 用于确定一个映射到内存文件,AllocationSize经常是最小为文件大小。

Cache Manager Callbacks

Interactions between the file system and the Cache Manager are manipulated via a series ofcallback functions. These callback functions are registered on a per file basis with the Cache Manager and are then used by the Cache Manager in order to ensure that the data structures are "locked" prior to performing a file system operation.

文件系统和缓存管理器通过一系列callback函数操纵和交互。

Windows NT assumes there is a strict ordering in how resources are acquired between the file system, Cache Manager, and Memory Manager. If followed, this ordering will ensure that deadlocks do not occur. Of course, if it is not followed, deadlocks can (and will) occur. Specifically, file system resources are acquired first. Then Cache Manager resources are acquired. Finally, Memory Manager resources are acquired.

Windows NT 假设在文件系统,资源获取有严格顺序。以保证不发生死锁。特别是文件系统的资源是在第一位获取,然后是缓存管理器资源,最后是内存管理器资源。

Thus, these callbacks are used by the Cache Manager to honor this hierarchy. The callbacks required by the Cache Manager are:

typedef BOOLEAN (*PACQUIRE_FOR_LAZY_WRITE) (
        IN PVOID Context,
        IN BOOLEAN Wait
        );

typedef VOID (*PRELEASE_FROM_LAZY_WRITE) (
        IN PVOID Context
        );

typedef BOOLEAN (*PACQUIRE_FOR_READ_AHEAD) (
        IN PVOID Context,
        IN BOOLEAN Wait
        );

typedef VOID (*PRELEASE_FROM_READ_AHEAD) (
        IN PVOID Context
        );

typedef struct _CACHE_MANAGER_CALLBACKS {
        PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite;
        PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite;
        PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead;
        PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead;
} CACHE_MANAGER_CALLBACKS, *PCACHE_MANAGER_CALLBACKS;

 

注意到callbacks用于Cache Manager 的两个不同部分。首先是Lazy writer有责任写回脏缓存数据到文件系统。第二是为预读功能。

需要保护non-cached用户I/O操作和用户修改文件大小操作。NT文件系统使用两个ERESOURCE结构,从Common header的PERESOURCEResource
PERESOURCE PagingIoResource两个字段指定。Cache Manager并不直接获取资源相反调用文件系统获取必须资源。

static BOOLEAN OwAcquireForLazyWrite(PVOID Context, BOOLEAN Wait)
{
POW_FCB fcb = (POW_FCB) Context;
BOOLEAN result;

// Take out the lock on the file.

result = OwAcquireResourceExclusiveExp(&fcb->Resource, Wait);
if (!result) {

// We did not acquire the resource.

return (result);
}

// We did acquire the resource. We need to:
// (1) Store away the thread id of this thread (for the release)
// (2) Set top level irp to a pseudo value
// In both cases, the previous value should be zero.

OwAssert(!fcb->ResourceThread);
fcb->ResourceThread = OwGetCurrentResourceThread();
return (TRUE);
}

Each of the file systems in the Microsoft IFS kit also contains examples of routines like these. For the Lazy Writer these routines are located in the following locations:

 

File System

File

Routine

FAT

resrcsup.c

FatAcquireFcbForLazyWrite

CDFS

resrcsup.c

CdAcquireForCache

RDR2

rxce\resrcsup.c

RxAcquireFcbForLazyWrite

Other similar routines (for read ahead for example) can be located in the same file.

另外相似例程预读等可在同一个文件找到。

CcCanlWrite

Because an application program can modify data in memory at a rate that exceeds the ability to write the data to disk, the Virtual Memory system can "fill up" with data. This in turn can then cause fatal out-of-memory conditions to occur within the VM system. To avoid this, the file system must cooperate with the VM system to detect these conditions. One of the key operations provided by the Cache Manager for this support isCcCanIWrite. The prototype for this call is:

应用程序可修改内存数据的速率超出写数据到磁盘,虚拟内存系统可被数据填满。

判断是否可以写入数据到缓存。

NTKERNELAPI BOOLEAN CcCanIWrite (
    IN PFILE_OBJECT FileObject,
    IN ULONG BytesToWrite,
    IN BOOLEAN Wait,
    IN BOOLEAN Retrying
    );

PS C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp> npm install Debugger attached. npm warn deprecated lodash.template@4.5.0: This package is deprecated. Use https://socket.dev/npm/package/eta instead. npm warn deprecated shvl@2.0.3: older versions vulnerable to prototype pollution npm warn deprecated docsearch.js@2.6.3: This package has been deprecated and is no longer maintained. Please use @docsearch/js. npm warn deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility npm warn deprecated q@1.5.1: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. npm warn deprecated npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) npm warn deprecated figgy-pudding@3.5.2: This module is no longer supported. npm warn deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm warn deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm warn deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated npm warn deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm warn deprecated har-validator@5.1.5: this library is no longer supported npm warn deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x. npm warn deprecated gauge@2.7.4: This package is no longer supported. npm warn deprecated osenv@0.1.5: This package is no longer supported. npm warn deprecated are-we-there-yet@1.1.7: This package is no longer supported. npm warn deprecated npmlog@4.1.2: This package is no longer supported. npm warn deprecated fstream@1.0.12: This package is no longer supported. npm warn deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. npm warn deprecated fs-write-stream-atomic@1.0.10: This package is no longer supported. npm warn deprecated copy-concurrently@1.0.5: This package is no longer supported. npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated move-concurrently@1.0.1: This package is no longer supported. npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported npm warn deprecated consolidate@0.15.1: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog npm warn deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained npm warn deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained npm warn deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142 npm warn deprecated @hapi/joi@15.1.1: Switch to 'npm install joi' npm warn deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm warn deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address' npm warn deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated npm warn deprecated webpack-chain@4.12.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. npm warn deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported npm warn deprecated highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest npm warn deprecated @babel/plugin-proposal-async-generator-functions@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead. npm warn deprecated @babel/plugin-proposal-optional-catch-binding@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead. npm warn deprecated @babel/plugin-proposal-json-strings@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-json-strings instead. npm warn deprecated @babel/plugin-proposal-unicode-property-regex@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-unicode-property-regex instead. npm warn deprecated @babel/plugin-proposal-object-rest-spread@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead. npm warn deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead. npm warn deprecated vuex-persistedstate@3.2.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. npm warn deprecated vue-i18n@8.28.2: Vue I18n v8.x has reached EOL and is no longer actively maintained. About maintenance status, see https://vue-i18n.intlify.dev/guide/maintenance.html npm warn deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates. npm warn deprecated eslint-loader@3.0.4: This loader has been deprecated. Please use eslint-webpack-plugin npm warn deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. npm warn deprecated node-sass@4.14.1: Node Sass is no longer supported. Please use `sass` or `sass-embedded` instead. npm warn deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410 npm warn deprecated eslint@5.16.0: This version is no longer supported. Please see https://eslint.org/version-support for other options. npm warn deprecated iscroll@5.2.0: deprecated npm warn deprecated mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) npm warn deprecated webpack-chain@6.5.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported npm warn deprecated vue@2.7.16: Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details. npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported npm warn deprecated webpack-chain@6.5.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. npm warn cleanup Failed to remove some directories [ npm warn cleanup [ npm warn cleanup '\\\\?\\C:\\fcube-app\\W11.F-CUBE-A-APP\\CL_CSM\\src\\main\\webapp\\node_modules', npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\@hapi'] { npm warn cleanup errno: -4048, npm warn cleanup code: 'EPERM', npm warn cleanup syscall: 'rmdir', npm warn cleanup path: 'C:\\fcube-app\\W11.F-CUBE-A-APP\\CL_CSM\\src\\main\\webapp\\node_modules\\@hapi' npm warn cleanup } npm warn cleanup ], npm warn cleanup [ npm warn cleanup '\\\\?\\C:\\fcube-app\\W11.F-CUBE-A-APP\\CL_CSM\\src\\main\\webapp\\node_modules\\@vue', npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\@vue\compiler-core\node_modules'] { npm warn cleanup errno: -4048, npm warn cleanup code: 'EPERM', npm warn cleanup syscall: 'rmdir', npm warn cleanup path: 'C:\\fcube-app\\W11.F-CUBE-A-APP\\CL_CSM\\src\\main\\webapp\\node_modules\\@vue\\compiler-core\\node_modules' npm warn cleanup } npm warn cleanup ], npm warn cleanup [ npm warn cleanup '\\\\?\\C:\\fcube-app\\W11.F-CUBE-A-APP\\CL_CSM\\src\\main\\webapp\\node_modules\\@vuepress', npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\@vuepress'] { npm warn cleanup errno: -4048, npm warn cleanup code: 'EPERM', npm warn cleanup syscall: 'rmdir', npm warn cleanup path: 'C:\\fcube-app\\W11.F-CUBE-A-APP\\CL_CSM\\src\\main\\webapp\\node_modules\\@vuepress' npm warn cleanup } npm warn cleanup ] npm warn cleanup ] npm error code 1 npm error path C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\node-sass npm error command failed npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js npm error Building: C:\Program Files\nodejs\node.exe C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm error Debugger attached. npm error Debugger attached. npm error gyp info it worked if it ends with ok npm error gyp verb cli [ npm error gyp verb cli 'C:\\Program Files\\nodejs\\node.exe', npm error gyp verb cli 'C:\\fcube-app\\W11.F-CUBE-A-APP\\CL_CSM\\src\\main\\webapp\\node_modules\\node-gyp\\bin\\node-gyp.js', npm error gyp verb cli 'rebuild', npm error gyp verb cli '--verbose', npm error gyp verb cli '--libsass_ext=', npm error gyp verb cli '--libsass_cflags=', npm error gyp verb cli '--libsass_ldflags=', npm error gyp verb cli '--libsass_library=' npm error gyp verb cli ] npm error gyp info using node-gyp@3.8.0 npm error gyp info using node@24.3.0 | win32 | x64 npm error gyp verb command rebuild [] npm error gyp verb command clean [] npm error gyp verb clean removing "build" directory npm error gyp verb command configure [] npm error gyp verb check python checking for Python executable "python2" in the PATH npm error gyp verb `which` failed Error: not found: python2 npm error gyp verb `which` failed at getNotFoundError (C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\which\which.js:13:12) npm error gyp verb `which` failed at F (C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\which\which.js:68:19) npm error gyp verb `which` failed at E (C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\which\which.js:80:29) npm error gyp verb `which` failed at C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\which\which.js:89:16 npm error gyp verb `which` failed at C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\isexe\index.js:42:5 npm error gyp verb `which` failed at C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\isexe\windows.js:36:5 npm error gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:189:21) npm error gyp verb `which` failed python2 Error: not found: python2 npm error gyp verb `which` failed at getNotFoundError (C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\which\which.js:13:12) npm error gyp verb `which` failed at F (C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\which\which.js:68:19) npm error gyp verb `which` failed at E (C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\which\which.js:80:29) npm error gyp verb `which` failed at C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\which\which.js:89:16 npm error gyp verb `which` failed at C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\isexe\index.js:42:5 npm error gyp verb `which` failed at C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\isexe\windows.js:36:5 npm error gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:189:21) { npm error gyp verb `which` failed code: 'ENOENT' npm error gyp verb `which` failed } npm error gyp verb check python checking for Python executable "python" in the PATH npm error gyp verb `which` succeeded python C:\Python313\python.EXE npm error (node:3656) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead. npm error (Use `node --trace-deprecation ...` to show where the warning was created) npm error gyp ERR! configure error npm error gyp ERR! stack Error: Command failed: C:\Python313\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; npm error gyp ERR! stack File "<string>", line 1 npm error gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; npm error gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ npm error gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? npm error gyp ERR! stack npm error gyp ERR! stack at genericNodeError (node:internal/errors:983:15) npm error gyp ERR! stack at wrappedFn (node:internal/errors:537:14) npm error gyp ERR! stack at ChildProcess.exithandler (node:child_process:415:12) npm error gyp ERR! stack at ChildProcess.emit (node:events:507:28) npm error gyp ERR! stack at maybeClose (node:internal/child_process:1101:16) npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) npm error gyp ERR! System Windows_NT 10.0.26100 npm error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\fcube-app\\W11.F-CUBE-A-APP\\CL_CSM\\src\\main\\webapp\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" npm error gyp ERR! cwd C:\fcube-app\W11.F-CUBE-A-APP\CL_CSM\src\main\webapp\node_modules\node-sass npm error gyp ERR! node -v v24.3.0 npm error gyp ERR! node-gyp -v v3.8.0 npm error gyp ERR! not ok npm error Waiting for the debugger to disconnect... npm error Build failed with error code: 1 npm error Waiting for the debugger to disconnect... npm error A complete log of this run can be found in: D:\node\node_cache\_logs\2025-08-22T05_02_59_796Z-debug-0.log Waiting for the debugger to disconnect...
最新发布
08-23
C:\Users\Administrator\Desktop\水站2\node-backend-master>npm install npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated npmlog@5.0.1: This package is no longer supported. npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported. npm warn deprecated gauge@3.0.2: This package is no longer supported. npm error code 1 npm error path C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\bcrypt npm error command failed npm error command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build npm error Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\bcrypt\lib\binding\napi-v3 --napi_version=10 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1) npm error node-pre-gyp info it worked if it ends with ok npm error node-pre-gyp info using node-pre-gyp@1.0.11 npm error node-pre-gyp info using node@22.16.0 | win32 | x64 npm error node-pre-gyp info check checked for "C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node" (not found) npm error node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.1.1/bcrypt_lib-v5.1.1-napi-v3-win32-x64-unknown.tar.gz npm error node-pre-gyp ERR! install request to https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.1.1/bcrypt_lib-v5.1.1-napi-v3-win32-x64-unknown.tar.gz failed, reason: connect ECONNREFUSED 127.0.0.1:443 npm error node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.1.1 and node@22.16.0 (node-v127 ABI, unknown) (falling back to source compile with node-gyp) npm error node-pre-gyp WARN Hit error request to https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.1.1/bcrypt_lib-v5.1.1-napi-v3-win32-x64-unknown.tar.gz failed, reason: connect ECONNREFUSED 127.0.0.1:443 npm error gyp info it worked if it ends with ok npm error gyp info using node-gyp@11.0.0 npm error gyp info using node@22.16.0 | win32 | x64 npm error gyp info ok npm error gyp info it worked if it ends with ok npm error gyp info using node-gyp@11.0.0 npm error gyp info using node@22.16.0 | win32 | x64 npm error gyp ERR! find Python npm error gyp ERR! find Python Python is not set from command line or npm configuration npm error gyp ERR! find Python Python is not set from environment variable PYTHON npm error gyp ERR! find Python checking if the py launcher can be used to find Python 3 npm error gyp ERR! find Python - executable path is "" npm error gyp ERR! find Python - "" could not be run npm error gyp ERR! find Python checking if "python3" can be used npm error gyp ERR! find Python - executable path is "" npm error gyp ERR! find Python - "" could not be run npm error gyp ERR! find Python checking if "python" can be used npm error gyp ERR! find Python - executable path is "" npm error gyp ERR! find Python - "" could not be run npm error gyp ERR! find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python311\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files\Python311\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files\Python311\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python311-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python311-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files\Python311-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files\Python311-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python311-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files (x86)\Python311-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files\Python310\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files\Python310\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python310-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python310-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files\Python310-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files\Python310-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python310-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files (x86)\Python310-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python39-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run npm error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe npm error gyp ERR! find Python - version is "" npm error gyp ERR! find Python - version is - should be >=3.6.0 npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED npm error gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run npm error gyp ERR! find Python npm error gyp ERR! find Python ********************************************************** npm error gyp ERR! find Python You need to install the latest version of Python. npm error gyp ERR! find Python Node-gyp should be able to find and use Python. If not, npm error gyp ERR! find Python you can try one of the following options: npm error gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe" npm error gyp ERR! find Python (accepted by both node-gyp and npm) npm error gyp ERR! find Python - Set the environment variable PYTHON npm error gyp ERR! find Python - Set the npm configuration variable python: npm error gyp ERR! find Python npm config set python "C:\Path\To\python.exe" npm error gyp ERR! find Python For more information consult the documentation at: npm error gyp ERR! find Python https://github.com/nodejs/node-gyp#installation npm error gyp ERR! find Python ********************************************************** npm error gyp ERR! find Python npm error gyp ERR! configure error npm error gyp ERR! stack Error: Could not find any Python installation to use npm error gyp ERR! stack at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:306:11) npm error gyp ERR! stack at PythonFinder.findPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:164:17) npm error gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:105:5) npm error gyp ERR! stack at async configure (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:27:18) npm error gyp ERR! stack at async run (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js:81:18) npm error gyp ERR! System Windows_NT 10.0.19045 npm error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\Administrator\\Desktop\\水站2\\node-backend-master\\node_modules\\bcrypt\\lib\\binding\\napi-v3\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\Users\\Administrator\\Desktop\\水站2\\node-backend-master\\node_modules\\bcrypt\\lib\\binding\\napi-v3" "--napi_version=10" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3" npm error gyp ERR! cwd C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\bcrypt npm error gyp ERR! node -v v22.16.0 npm error gyp ERR! node-gyp -v v11.0.0 npm error gyp ERR! not ok npm error node-pre-gyp ERR! build error npm error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\bcrypt\lib\binding\napi-v3 --napi_version=10 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1) npm error node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) npm error node-pre-gyp ERR! stack at ChildProcess.emit (node:events:518:28) npm error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1101:16) npm error node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:304:5) npm error node-pre-gyp ERR! System Windows_NT 10.0.19045 npm error node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Administrator\\Desktop\\水站2\\node-backend-master\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" npm error node-pre-gyp ERR! cwd C:\Users\Administrator\Desktop\水站2\node-backend-master\node_modules\bcrypt npm error node-pre-gyp ERR! node -v v22.16.0 npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11 npm error node-pre-gyp ERR! not ok npm error A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2025-06-09T04_56_26_267Z-debug-0.log
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值