创建第一个rust tauri项目

安装nodejs

curl -sL https://deb.nodesource.com/setup_20.x | sudo bash
node -v
proxychains4 npm create tauri-app@latest
✔ Project name · tauri-app
✔ Choose which language to use for your frontend · TypeScript / JavaScript - (pnpm, yarn, npm, bun)
✔ Choose your package manager · npm
✔ Choose your UI template · React - (https://react.dev/)
✔ Choose your UI flavor · JavaScript

Template created! To get started run:
  cd tauri-app
  npm install
  npm run tauri dev

由于wsl2会遇到渲染相关的报错,切换到windows。
windows包管理器安装nodejs。
https://nodejs.org/en/download/package-manager

# installs fnm (Fast Node Manager)
winget install Schniz.fnm --proxy "http://xxx:7890" --location "D:\winget"
# 创建$profile文件:粘贴到powershell后,按回车
if (!(Test-Path -Path $PROFILE)) {
    New-Item -ItemType File -Path $PROFILE -Force
}
# 更改配置文件
notepad $profile
# 在打开的notepad中,粘贴以下代码,并保存
fnm env --use-on-cd | Out-String | Invoke-Expression
# 重新用管理员身份开启powershell
# 让$profile可以被读取,更改权限
set-ExecutionPolicy RemoteSigned

# download and install Node.js
fnm use --install-if-missing 20
# verifies the right Node.js version is in the environment
node -v # should print `v20.16.0`
# verifies the right npm version is in the environment
npm -v # should print `10.8.1`

powershell设置代理

解决网络问题。

$env:HTTPS_PROXY="http://127.0.0.1:7890"
$env:HTTP_PROXY="http://127.0.0.1:7890"
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值