Windows10系统安装Truffle框架,安装失败,提示:error An unexpected error occurred: “https://xxxxx

简介: Windows10系统安装Truffle框架,安装失败,提示:error An unexpected error occurred: “https://xxxxx

Windows10系统安装Truffle框架,安装失败集锦,提示:error An unexpected error occurred: "https://xxxxx


Windows10安装truffle框架需要满足下面两个条件

  1. 基础安装环境
  2. 用到npm或者yarn命令,择一。

一、基础安装环境(技术选型)

  • Solidity - 0.8.10 (solc-js)
  • Node v14.18.1
  • Web3.js v1.5.3
  • python3.7gyp需要)
  • msbuild
  • npm
  • yarn

以上环境的安装搭建大家可以自己查询资料和博客解决。(少一个不行)

二、npm命令或者yarn命令安装truffle

命令:

yarn global add truffle
npm install -g truffle

在这里我们选择第二个命令,用npm的方式安装。

三、遇到的问题

【1】==》yarn报错error An unexpected error occurred: "https://xxxxx

【2】==》info There appears to be trouble with your network connection. Retrying…

【3】==》fatal: unable to access 'https://github.com/…'的解决办法(亲测有效)

❤️分析:yarn命令安装出现这个错误主要是网络问题,再重新设置代理之后,yarn命令还是不能安装truffle,我的电脑不能正常访问github,需要更换淘宝镜像,但换了镜像依然不能,所以这里采用npm命令安装。

【4】==》npm install报错RunScriptError: post install error, please remove node_modules before retry!

❤️分析:这个问题主要是由于本机缺少msbuild 编译环境,可以重新安装Visualstudio2022代码集成编译器,也就是写C语言的工具。如下图所示:(因为Visualstudio2022集成了msbuild环境。)

❤️统一解决方案❤️:

npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
  • 升级npm到最新版本:
npm i npm g
  • 安装truffle
npm install -g truffle
  • 验证truffle:

因为这里是Windows系统,所以需要使用到npx命令,在Linux环境中的话,不需要npx命令。

npx truffle
npx truffle version

如下图成功:

目录
相关文章
|
2月前
|
安全 Unix Linux
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
67 5
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
|
2月前
|
数据采集 安全 Linux
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
49 4
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
|
2月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
64 4
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
|
3月前
|
存储 安全 Linux
Metasploit Pro 4.22.7-2025040601 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025040601 (Linux, Windows) - 专业渗透测试框架
138 1
Metasploit Pro 4.22.7-2025040601 (Linux, Windows) - 专业渗透测试框架
|
3月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.55 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.55 (macOS, Linux, Windows) - 开源渗透测试框架
88 0
Metasploit Framework 6.4.55 (macOS, Linux, Windows) - 开源渗透测试框架
|
7月前
|
Ubuntu Linux Shell
(已解决)Linux环境—bash: wget: command not found; Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
(已成功解决)Linux环境报错—bash: wget: command not found;常见Linux发行版本,Linux中yum、rpm、apt-get、wget的区别;Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
2656 68
(已解决)Linux环境—bash: wget: command not found; Docker pull报错Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
|
5月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
89 0
Metasploit Framework 6.4.49 (macOS, Linux, Windows) - 开源渗透测试框架
|
6月前
|
关系型数据库 MySQL Docker
docker pull mysql:8.0.26提示Error response from daemon: Get “https://registry-1.docker.io/v2/“: EOF错误
docker pull mysql:8.0.26提示Error response from daemon: Get “https://registry-1.docker.io/v2/“: EOF错误
|
7月前
|
安全 Ubuntu Linux
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架
104 9
Metasploit Pro 4.22.6-2024111901 (Linux, Windows) - 专业渗透测试框架
|
7月前
|
Linux C# iOS开发
开源GTKSystem.Windows.Forms框架让C# Winform支持跨平台运行
开源GTKSystem.Windows.Forms框架让C# Winform支持跨平台运行
138 12