windows下安装truffle

介绍

Truffle 是一个开发智能合约的工具,也可以用来做 DAPP

安装

在node的环境下,执行命令

# 安装truffle
npm install -g truffle
# 查询当前的 Truffle 版本
truffle -v

注意这里node版本不能太高,我在使用Node 16.14.0时出现以下错误

yp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - executable path is "C:\Users\ս��\.windows-build-tools\python27\python.exe"
gyp ERR! find Python - "C:\Users\ս��\.windows-build-tools\python27\python.exe" could not be run
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if the py launcher can be used to find Python 2
gyp ERR! find Python - executable path is "C:\Users\ս��\.windows-build-tools\python27\python.exe"
gyp ERR! find Python - "C:\Users\ս��\.windows-build-tools\python27\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.

安装了phthon环境后依旧无法安装,最后使用nvm(注意修改成国内源)将node切换至v12.16.0才成功安装

Logo

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。

更多推荐