idea fetching documentation解决

本文介绍了解决IntelliJ IDEA中Javadoc加载缓慢或无法加载的问题。通过修改配置文件,禁用指向Oracle的Javadoc链接,使得IDE能够正确读取本地Javadoc。

使用idea的某天突然发现鼠标放在方法名上时无法获取到javadoc,悬浮框里一致显示fetching documentation… 最后发现了原因是javadoc的获取来源指定了oracle的地址,可以通过以下方法解决:
首先找到 用户目录.IntelliJIdea2016.2\config\options\jdk.table.xml 这个文件打开

<application>
  <component name="ProjectJdkTable">
    <jdk version="2">
      <name value="1.8" />
      <type value="JavaSDK" />
      <version value="java version &quot;1.8.0_20&quot;" />
      <homePath value="D:/zhao/jdk" />
      <roots>
        <annotationsPath>
          <root type="composite">
            <root type="simple" url="jar://$APPLICATION_HOME_DIR$/lib/jdkAnnotations.jar!/" />
          </root>
        </annotationsPath>
        <classPath>
          <root type="composite">
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/charsets.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/deploy.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/access-bridge-64.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/cldrdata.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/dnsns.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/jaccess.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/jfxrt.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/localedata.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/nashorn.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/sunec.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/sunjce_provider.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/sunmscapi.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/sunpkcs11.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/ext/zipfs.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/javaws.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/jce.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/jfr.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/jfxswt.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/jsse.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/management-agent.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/plugin.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/resources.jar!/" />
            <root type="simple" url="jar://D:/zhao/jdk/jre/lib/rt.jar!/" />
          </root>
        </classPath>
        <javadocPath>
          <root type="composite" />
        </javadocPath>
        <sourcePath>
          <root type="composite">
            <root type="simple" url="jar://D:/zhao/jdk/src.zip!/" />
            <root type="simple" url="jar://D:/zhao/jdk/javafx-src.zip!/" />
          </root>
        </sourcePath>
      </roots>
      <additional />
    </jdk>
    <jdk version="2">
      <name value="1.7" />
      <type value="JavaSDK" />
      <version value="java version &quot;1.7.0_45&quot;" />
      <homePath value="D:/zhao/java/jdk1.7.0_45" />
      <roots>
        <annotationsPath>
          <root type="composite">
            <root type="simple" url="jar://$APPLICATION_HOME_DIR$/lib/jdkAnnotations.jar!/" />
          </root>
        </annotationsPath>
        <classPath>
          <root type="composite">
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/charsets.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/deploy.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/access-bridge.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/dnsns.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/jaccess.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/localedata.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/sunec.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/sunjce_provider.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/sunmscapi.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/sunpkcs11.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/ext/zipfs.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/javaws.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/jce.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/jfr.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/jfxrt.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/jsse.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/management-agent.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/plugin.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/resources.jar!/" />
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/jre/lib/rt.jar!/" />
          </root>
        </classPath>
        <javadocPath>
          <root type="composite">
            <root type="simple" url="http://docs.oracle.com/javafx/2/api/" />
          </root>
        </javadocPath>
        <sourcePath>
          <root type="composite">
            <root type="simple" url="jar://D:/zhao/java/jdk1.7.0_45/src.zip!/" />
          </root>
        </sourcePath>
      </roots>
      <additional />
    </jdk>
  </component>
</application>

这里我的环境装了2个jdk,仔细看可以发现1.7的版本下比1.8多了一行配置

<javadocPath>
          <root type="composite">
            <root type="simple" url="http://docs.oracle.com/javafx/2/api/" />
          </root>
        </javadocPath>

这个时候在使用1.7的jdk的情况下,如果你的网络有限制连不上oracle的网站,就会出现一直fetching documentation 的情况,我们只需要将 url所在的那一行删掉就能正常读取到本地的javadoc了。

PS D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue> yarn yarn install v1.22.22 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning " > @rongcloud/plugin-call@5.2.3-enterprise.2" has incorrect peer dependency "@rongcloud/engine@5.8.2-enterprise.1". warning " > @rongcloud/plugin-rtc@5.6.15-enterprise.2" has incorrect peer dependency "@rongcloud/engine@5.8.2-enterprise.1". [4/4] Building fresh packages... [1/7] ⢀ @rongcloud/electron [7/7] ⢀ electron [3/7] ⢀ sqlite3 [-/7] ⢀ waiting... error D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build Arguments: Directory: D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 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@20.10.0 | win32 | x64 node-pre-gyp info check checked for "D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node" (not found) node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz node-pre-gyp ERR! install request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443 node-pre-gyp WARN Pre-built binaries not installable for sqlite3@5.1.6 and node@20.10.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443 gyp info it worked if it ends with ok gyp info using node-gyp@8.4.1 gyp info using node@20.10.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@20.10.0 | win32 | x64 gyp info find Python using Python version 3.6.5 found at "D:\Anaconda\python.exe" gyp http GET https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz gyp http GET https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt gyp http GET https://nodejs.org/download/release/v20.10.0/win-x86/node.lib gyp http GET https://nodejs.org/download/release/v20.10.0/win-x64/node.lib gyp http GET https://nodejs.org/download/release/v20.10.0/win-arm64/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v20.10.0/win-x64/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/win-x86/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/win-arm64/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 could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details 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 (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:122:47) gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:75:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:363:14) gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:71:14 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:384:16 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\util.js:54:7 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\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:514: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.22631 gyp ERR! command "D:\\tools\\nodejs\\node.exe" "D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-x64" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6" gyp ERR! cwd D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 gyp ERR! node -v v20.10.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 'D:\tools\nodejs\node.exe D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:514: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.22631 node-pre-gyp ERR! command "D:\\tools\\nodejs\\node.exe" "D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 node-pre-gyp ERR! node -v v20.10.0 node-pre-gyp ERR! node-pre-gyp -v v1.0.11 node-pre-gyp ERR! not ok Failed to execute 'D:\tools\nodejs\node.exe D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\elePS D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue> yarn yarn install v1.22.22 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning " > @rongcloud/plugin-call@5.2.3-enterprise.2" has incorrect peer dependency "@rongcloud/engine@5.8.2-enterprise.1". warning " > @rongcloud/plugin-rtc@5.6.15-enterprise.2" has incorrect peer dependency "@rongcloud/engine@5.8.2-enterprise.1". [4/4] Building fresh packages... [1/7] ⢀ @rongcloud/electron [7/7] ⢀ electron [3/7] ⢀ sqlite3 [-/7] ⢀ waiting... error D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build Arguments: Directory: D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 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@20.10.0 | win32 | x64 node-pre-gyp info check checked for "D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node" (not found) node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz node-pre-gyp ERR! install request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443 node-pre-gyp WARN Pre-built binaries not installable for sqlite3@5.1.6 and node@20.10.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.6/napi-v6-win32-unknown-x64.tar.gz failed, reason: connect ETIMEDOUT 20.205.243.166:443 gyp info it worked if it ends with ok gyp info using node-gyp@8.4.1 gyp info using node@20.10.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@20.10.0 | win32 | x64 gyp info find Python using Python version 3.6.5 found at "D:\Anaconda\python.exe" gyp http GET https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz gyp http GET https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt gyp http GET https://nodejs.org/download/release/v20.10.0/win-x86/node.lib gyp http GET https://nodejs.org/download/release/v20.10.0/win-x64/node.lib gyp http GET https://nodejs.org/download/release/v20.10.0/win-arm64/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v20.10.0/win-x64/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/win-x86/node.lib gyp http 200 https://nodejs.org/download/release/v20.10.0/win-arm64/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 could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details 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 (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:122:47) gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:75:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:363:14) gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:71:14 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\find-visualstudio.js:384:16 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\lib\util.js:54:7 gyp ERR! stack at D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\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:514: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.22631 gyp ERR! command "D:\\tools\\nodejs\\node.exe" "D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\sqlite3\\lib\\binding\\napi-v6-win32-unknown-x64" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6" gyp ERR! cwd D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 gyp ERR! node -v v20.10.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 'D:\tools\nodejs\node.exe D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:514: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.22631 node-pre-gyp ERR! command "D:\\tools\\nodejs\\node.exe" "D:\\idea\\IDEA 2024.1\\IntelliJ IDEA 2024.1\\add\\electron-vite-vue\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\sqlite3 node-pre-gyp ERR! node -v v20.10.0 node-pre-gyp ERR! node-pre-gyp -v v1.0.11 node-pre-gyp ERR! not ok Failed to execute 'D:\tools\nodejs\node.exe D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\electron-vite-vue\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=D:\idea\IDEA 2024.1\IntelliJ IDEA 2024.1\add\ele
07-25
<think>好的,用户之前遇到了Yarn命令无法识别的问题,现在又提出了Yarn安装时找不到Git二进制文件的错误。我需要结合之前的对话和新的引用内容来解答。首先,用户提供的引用[1]提到Git权限被拒绝的问题,这可能与SSH密钥配置有关。引用[3]指出需要特定版本的Node.js和Yarn,而引用[4]中的Dockerfile展示了安装Git、Node.js和Yarn的步骤。这可能意味着用户的环境中缺少Git或路径配置不正确。 接下来,我需要分步骤解决这个问题。首先,确认Git是否安装,因为Yarn在安装某些包时会依赖Git。如果Git未安装,用户需要下载并安装,并确保添加到系统路径中。然后,检查环境变量,确保Git的可执行文件路径正确。如果路径有问题,用户需要手动添加。另外,引用[1]中的权限问题可能和SSH密钥有关,但用户当前的问题是关于找不到Git二进制文件,所以可能不需要处理密钥,除非安装的是私有仓库的包。但用户的问题更可能是Git本身未安装或路径错误。此外,用户可能在使用npm安装包时,需要Git来克隆仓库,比如引用[2]中的git-lfs,所以确保Git正确安装是关键。最后,建议用户验证Git的安装,并检查Yarn的配置,确保一切设置正确。</think>### Yarn安装时"Git二进制文件未找到"错误解决方案 #### 1. **验证Git安装状态** - 在终端执行: ```bash git --version ``` 若提示`command not found`,需安装Git[^4] #### 2. **安装Git客户端** - Windows系统: 1. 访问[Git官网](https://git-scm.com/)下载安装包 2. 安装时勾选**Add Git to PATH**选项(关键步骤)[^4] ![Git安装路径配置示例](https://i.imgur.com/7JzQq9L.png) - Linux系统: ```bash sudo apt-get install git ``` #### 3. **配置环境变量** - 查找Git安装路径(默认路径): ```bash C:\Program Files\Git\cmd\git.exe # Windows /usr/bin/git # Linux/macOS ``` - 将路径添加到系统环境变量`PATH`中[^3] #### 4. **验证Yarn配置** - 检查Yarn是否使用正确Git路径: ```bash yarn config get git-path ``` - 手动设置Git路径(若检测失败): ```bash yarn config set git-path "C:\Program Files\Git\cmd\git.exe" ``` #### 5. **处理私有仓库依赖** - 当安装依赖包含`git+ssh`协议时,需配置SSH密钥: 1. 生成SSH密钥: ```bash ssh-keygen -t ed25519 -C "your_email@example.com" ``` 2. 将公钥`id_ed25519.pub`内容添加到Git账户[^1] #### 6. **重试安装命令** - 清除缓存后重新安装: ```bash yarn cache clean yarn install --verbose ``` --- ### 错误排查矩阵 | 错误现象 | 解决方案 | |---------|----------| | `ENOGIT`错误 | 检查Git环境变量配置 | | `git@github.com: Permission denied` | 重新配置SSH密钥[^1] | | `git lfs`相关错误 | 安装git-lfs扩展[^2] | --- ### 典型错误日志分析 ```log npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/getredash/sql-formatter.git npm ERR! git@github.com: Permission denied (publickey) ``` 此错误表明: 1. 系统未正确识别Git可执行文件路径 2. SSH密钥认证失败(涉及私有仓库时) 3. 可能需要配置git-lfs支持大文件下载[^2] --- ### 相关问题 1. 如何验证SSH密钥是否已正确添加到Git账户? 2. Yarn安装时出现`git-lfs`错误该如何处理? 3. Windows系统下Git路径配置的注意事项有哪些? 4. 为什么有些npm包需要Git环境才能安装? 5. 如何为Yarn配置镜像源加速依赖安装?[^4]
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值