当前位置: 首页 > article >正文

Ubuntu系统下 npm install -g tauri 报错问题处理

处理在安装 Tauri 时遇到的问题,可以按照以下步骤进行操作

 npm install -g tauri
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 glob@7.2.3: Glob versions prior to v9 are no longer supported
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 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 har-validator@5.1.5: this library is no longer supported
npm warn deprecated gauge@2.7.4: This package is no longer supported.
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 w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
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 domexception@2.0.1: Use your platform's native DOMException instead
npm warn deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated @tauri-apps/tauri-inliner@1.14.1: Tauri now uses a custom protocol for asset loading so this package is not used anymore.
npm warn deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm error code 1
npm error path /root/.nvm/versions/node/v20.18.1/lib/node_modules/tauri/node_modules/sharp
npm error command failed
npm error command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm error make: Entering directory '/root/.nvm/versions/node/v20.18.1/lib/node_modules/tauri/node_modules/sharp/build'
npm error   CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
npm error rm -f Release/obj.target/../node-addon-api/nothing.a Release/obj.target/../node-addon-api/nothing.a.ar-file-list; mkdir -p `dirname Release/obj.target/../node-addon-api/nothing.a`
npm error ar crs Release/obj.target/../node-addon-api/nothing.a @Release/obj.target/../node-addon-api/nothing.a.ar-file-list
npm error   COPY Release/nothing.a
npm error   TOUCH Release/obj.target/libvips-cpp.stamp
npm error   CXX(target) Release/obj.target/sharp/src/common.o
npm error make: Leaving directory '/root/.nvm/versions/node/v20.18.1/lib/node_modules/tauri/node_modules/sharp/build'
npm error info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-linux-x64.tar.br
npm error ERR! sharp Request timed out
npm error info sharp Attempting to build from source via node-gyp but this may fail due to the above error
npm error info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@10.1.0
npm error gyp info using node@20.18.1 | linux | x64
npm error gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
npm error gyp http GET https://nodejs.org/download/release/v20.18.1/node-v20.18.1-headers.tar.gz
npm error gyp http 200 https://nodejs.org/download/release/v20.18.1/node-v20.18.1-headers.tar.gz
npm error gyp http GET https://nodejs.org/download/release/v20.18.1/SHASUMS256.txt
npm error gyp http 200 https://nodejs.org/download/release/v20.18.1/SHASUMS256.txt
npm error gyp info spawn /usr/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/root/.nvm/versions/node/v20.18.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.nvm/versions/node/v20.18.1/lib/node_modules/tauri/node_modules/sharp/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.nvm/versions/node/v20.18.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.cache/node-gyp/20.18.1/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/20.18.1',
npm error gyp info spawn args '-Dnode_gyp_dir=/root/.nvm/versions/node/v20.18.1/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/20.18.1/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/root/.nvm/versions/node/v20.18.1/lib/node_modules/tauri/node_modules/sharp',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error <command-line>: warning: "_GLIBCXX_USE_CXX11_ABI" redefined
npm error <command-line>: note: this is the location of the previous definition
npm error ../src/common.cc:24:10: fatal error: vips/vips8: No such file or directory
npm error    24 | #include <vips/vips8>
npm error       |          ^~~~~~~~~~~~
npm error compilation terminated.
npm error make: *** [sharp.target.mk:136: Release/obj.target/sharp/src/common.o] Error 1
npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/root/.nvm/versions/node/v20.18.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm error gyp ERR! System Linux 5.15.0-113-generic
npm error gyp ERR! command "/root/.nvm/versions/node/v20.18.1/bin/node" "/root/.nvm/versions/node/v20.18.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /root/.nvm/versions/node/v20.18.1/lib/node_modules/tauri/node_modules/sharp
npm error gyp ERR! node -v v20.18.1
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok

处理在安装 Tauri 时遇到的问题,可以按照以下步骤进行操作:

1. 安装 sharp 所需的系统依赖

sharp 库需要一些系统依赖项。根据您使用的 Linux 发行版,您可以使用以下命令安装这些依赖项:

对于 Ubuntu/Debian:

sudo apt-get update
sudo apt-get install -y build-essential libvips-dev

对于 Fedora:

sudo dnf install -y gcc-c++ make vips-devel

对于 Arch Linux:

sudo pacman -S --needed base-devel vips

2. 清除 npm 缓存

有时,清除 npm 缓存可以帮助解决安装问题:

npm cache clean --force

3. 重新安装 Tauri

安装完所需的依赖项后,尝试重新安装 Tauri:

npm install -g tauri

4. 检查 Node.js 和 npm 版本

确保您使用的是兼容的 Node.js 和 npm 版本。Tauri 通常与 LTS 版本的 Node.js 配合良好。您可以使用以下命令检查版本:

node -v
npm -v

如果需要切换 Node.js 版本,可以使用 nvm(Node 版本管理器)安装不同的版本:

nvm install --lts
nvm use --lts

5. 使用 Yarn 作为替代

如果您继续遇到 npm 的问题,可以尝试使用 Yarn 作为替代的包管理器:

npm install -g yarn
yarn global add tauri

6. 检查网络问题

错误信息中提到的 Request timed out 表示可能存在网络问题。确保您的互联网连接稳定,并且没有防火墙或代理设置阻止请求。

7. 查看日志文件

如果安装再次失败,请检查错误输出中提到的日志文件,以获取更多详细信息。


http://www.kler.cn/a/452717.html

相关文章:

  • c++ 类似与c# 线程 AutoResetEvent 和 ManualResetEvent的实现
  • linux系统上SQLPLUS的重“大”发现
  • 命令手动更新 Navigator
  • Java预加载
  • 【求职面试】驾照的种类
  • 基于earthSDK三维地图组件开发
  • pnpm、Yarn 和 npm 的区别?
  • MySQL用表组织数据
  • 面试经典问题 —— 最大/小前K个数问题(top - K)问题
  • postgresql ERROR: cannot drop the currently open database
  • Java处理视频思路
  • 【接口自动化连载】使用yaml配置文件自动生成接口case
  • Postman最新接口自动化持续集成
  • 虚拟机桥接模式网络连接不上解决方法
  • SQL server学习10-数据库编程(中)
  • 常用的 JVM 调优的参数
  • 【C++多重类循环依赖问题】基于class前向声明与类定义和实现分离的解决方案与分析
  • 解决 Docker 中 DataLoader 多进程错误:共享内存不足
  • ES 集群 A 和 ES 集群 B 数据流通
  • 【数据分析】似然和极大似然估计
  • SQLSERVER、MYSQL LIKE查询特殊字符和转义字符相同与不同
  • 用Python开发高级游戏:实现3D迷宫游戏
  • 【Ubuntu】如何轻松设置80和443端口的防火墙
  • 如何使用Windows快捷键在多显示器间移动窗口
  • Git 代理配置——克隆仓库时遇到 OpenSSL SSL_ERROR_SYSCALL 的解决方案
  • 详解Ollama api (Windows环境)