Skip to content
TheChatArchiveThe Chat Archive
gpt-4-1106-preview· openaiHugging Face Suzhen/CodeChat

如何解决: F:\Flowise>yarn install yarn install v1.22.19 info No lockfile found. [1/5]…

  1. User

    如何解决: F:\Flowise>yarn install yarn install v1.22.19 info No lockfile found. [1/5] Validating package.json... error flowise@1.4.5: The engine "node" is incompatible with this module. Expected version ">=18.15.0". Got "18.12.1" error Found incompatible module. info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

    F:\Flowise>nvm list

    • 18.12.1 (Currently using 64-bit executable) 16.19.0
  2. Assistant

    错误信息表明您当前使用的 Node.js 版本是 18.12.1,但是 flowise 项目的 package.json 文件指定了该项目需要 Node.js 版本为 18.15.0 或更高版本。由于版本不匹配,所以出现了不兼容的模块错误。

    为了解决这个问题,您需要升级 Node.js 到至少 18.15.0 版本。由于您正在使用 nvm (Node Version Manager),可以比较轻松地进行版本切换。以下是升级 Node.js 版本的步骤:

    1. 安装所需的 Node.js 版本: 使用 nvm 命令安装最新的 Node.js 18.x 版本(或至少 18.15.0 版本):

      nvm install 18.15.0
      
    2. 切换到新安装的 Node.js 版本: 安装完新版本后,使用 nvm 切换到该版本:

      nvm use 18.15.0
      
    3. 验证 Node.js 版本: 确认当前正在使用的 Node.js 版本是否正确:

      node -v
      

      这应该显示 18.15.0 或您安装的更高版本。

    4. 重新运行 yarn install: 现在,您应该可以在新的 Node.js 版本环境中运行 yarn 安装命令而不会遇到兼容性问题:

      yarn install
      

    如果您希望该版本成为默认版本,您可以设置 nvm 默认使用该版本:

    nvm alias default 18.15.0
    

    现在问题应该已经解决了,您可以继续工作。

  3. User

    [5/5] Building fresh packages... [-/15] ⠠ waiting... [6/15] ⠠ canvas [-/15] ⠐ waiting... [7/15] ⠐ puppeteer warning Error running install script for optional dependency: "F:\Flowise\node_modules\canvas: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build --update-binary Arguments: Directory: F:\Flowise\node_modules\canvas Output: node-pre-gyp info it worked if it ends with ok node-pre-gyp info using node-pre-gyp@1.0.11 node-pre-gyp info using node@21.3.0 | win32 | x64 (node:26892) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created) node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v120-win32-unknown-x64.tar.gz node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v120-win32-unknown-x64.tar.gz node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@21.3.0 (node-v120 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v120-win32-unknown-x64.tar.gz gyp info it worked if it ends with ok gyp info using node-gyp@8.4.1 gyp info using node@21.3.0 | win32 | x64 gyp info ok gyp info it worked if it ends with ok gyp info using node-gyp@8.4.1 gyp info using node@21.3.0 | win32 | x64 gyp info find Python using Python version 3.10.9 found at "D:\python\python.exe" gyp http GET https://nodejs.org/download/release/v21.3.0/node-v21.3.0-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v21.3.0/node-v21.3.0-headers.tar.gz gyp http GET https://nodejs.org/download/release/v21.3.0/SHASUMS256.txt gyp http GET https://nodejs.org/download/release/v21.3.0/win-x86/node.lib gyp http GET https://nodejs.org/download/release/v21.3.0/win-x64/node.lib gyp http GET https://nodejs.org/download/release/v21.3.0/win-arm64/node.lib gyp http 200 https://nodejs.org/download/release/v21.3.0/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v21.3.0/win-x64/node.lib gyp http 200 https://nodejs.org/download/release/v21.3.0/win-arm64/node.lib gyp http 200 https://nodejs.org/download/release/v21.3.0/win-x86/node.lib gyp ERR! find VS gyp ERR! find VS msvs_version not set from command line or npm config gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! find VS checking VS2022 (17.7.34202.233) found at: gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community" gyp ERR! find VS - found "Visual Studio C++ core features" gyp ERR! find VS - found VC++ toolset: v143 gyp ERR! find VS - missing any Windows SDK gyp ERR! find VS checking VS2022 (17.7.34202.233) found at: gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" gyp ERR! find VS - found "Visual Studio C++ core features" gyp ERR! find VS - found VC++ toolset: v143 gyp ERR! find VS - missing any Windows SDK gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use gyp ERR! find VS looking for Visual Studio 2015 gyp ERR! find VS - not found gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 gyp ERR! find VS gyp ERR! find VS ************************************************************** gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the "Desktop development with C++" workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows gyp ERR! find VS ************************************************************** gyp ERR! find VS gyp ERR! configure error gyp ERR! stack Error: Could not find any Visual Studio installation to use gyp ERR! stack at VisualStudioFinder.fail (F:\Flowise\node_modules\node-gyp\lib\find-visualstudio.js:122:47) gyp ERR! stack at F:\Flowise\node_modules\node-gyp\lib\find-visualstudio.js:75:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (F:\Flowise\node_modules\node-gyp\lib\find-visualstudio.js:363:14) gyp ERR! stack at F:\Flowise\node_modules\node-gyp\lib\find-visualstudio.js:71:14 gyp ERR! stack at F:\Flowise\node_modules\node-gyp\lib\find-visualstudio.js:384:16 gyp ERR! stack at F:\Flowise\node_modules\node-gyp\lib\util.js:54:7 gyp ERR! stack at F:\Flowise\node_modules\node-gyp\lib\util.js:33:16 gyp ERR! stack at ChildProcess.exithandler (node:child_process:430:5) gyp ERR! stack at ChildProcess.emit (node:events:519:28) gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) gyp ERR! System Windows_NT 10.0.22621 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "F:\\Flowise\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=F:\\Flowise\\node_modules\\canvas\\build\\Release\\canvas.node" "--module_name=canvas" "--module_path=F:\\Flowise\\node_modules\\canvas\\build\\Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v120" gyp ERR! cwd F:\Flowise\node_modules\canvas gyp ERR! node -v v21.3.0 gyp ERR! node-gyp -v v8.4.1 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe F:\Flowise\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=F:\Flowise\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=F:\Flowise\node_modules\canvas\build\Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v120' (1) node-pre-gyp ERR! stack at ChildProcess. (F:\Flowise\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:519:28) node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) node-pre-gyp ERR! System Windows_NT 10.0.22621 node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "F:\\Flowise\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--update-binary" node-pre-gyp ERR! cwd F:\Flowise\node_modules\canvas node-pre-gyp ERR! node -v v21.3.0 node-pre-gyp ERR! node-pre-gyp -v v1.0.11 node-pre-gyp ERR! not ok Failed to execute 'C:\Program Files\nodejs\node.exe F:\Flowise\node_modules\node-gyp\bin\node-gyp.js configure -success Saved lockfile. $ husky install husky - Git hooks installed Done in 230.63s.

  4. Assistant

    在尝试安装 canvas 依赖时出现了问题,这是因为没有找到合适的预先构建的二进制文件,node-pre-gyp 试图从一个 404 URL 获取它们,然后回退尝试编译过程。

    从错误日志来看,gyp 编译过程失败的主要原因是没有找到适当版本的 Visual Studio 或 Windows SDK。node-gyp 是一个用来编译原生 addon 模块的工具,它依赖于 C++ 编译器环境。确保你有适当的构建工具和环境非常关键。

    解决此编译问题的步骤通常如下:

    1. 安装 Windows 构建工具: 如果你还没有安装 C++ 构建环境,可以通过以下命令安装:

      npm install --global --production windows-build-tools
      

      这将下载并安装 Visual Studio 2017 的构建工具和相关依赖项。

    2. 安装最新版的 Visual Studio: 如果先前的步骤不奏效,你可能需要手动安装 Visual Studio。下载并安装最新的 Visual Studio 版本(确保包含 "Desktop development with C++" 工作负载和最新的 Windows 10 SDK)。

    3. 尝试重新编译: 在安装了必要的构建工具后,尝试再次运行 yarn install。

    4. 检查 Python 版本: 确保你的 Python 版本是与 node-gyp 兼容的。通常推荐使用 Python 2.7.x,但最新版本的 node-gyp 应当兼容 Python3。

    5. 检查 Node.js 版本: 从你提供的日志中可以看到,你正在使用 Node.js v21.3.0,这可能是一个过新的版本,导致编译问题。考虑使用一个更稳定的 LTS 版本,比如 Node.js 16.x 或 18.x。

    为了避免版本不稳定问题,你可以尝试运行以下命令来使用 Node.js 的一个长期支持版本:

    nvm install --lts
    nvm use --lts
    

    然后再次尝试运行 yarn install。如果问题依然存在,可能需要根据错误日志的具体信息逐步排查。

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.