Blockchain development: (3) Ethereum development environment to build-truffle and TESTRPC installation

Source: Internet
Author: User
Tags curl install node

Truffle is a local tool for compiling and deploying smart contracts, and TESTRPC is different from Geth,geth is a true ethereum environment, and TESTRPC is an ethereum environment that uses memory simulations locally, which is more convenient and fast for development and commissioning. When your contract is tested in TESTRPC, you can then deploy it to Geth. So it can be said that truffle and Testrpc are two big killing device.
1. Install node. js

CURL-SL https://deb.nodesource.com/setup_6.x | SUDO-E bash-#若未安装curl, install #必须root下执行 via sudo apt install curl

, default root user not set password is not available, set root user password via sudo passwd (apt: Advance Package tool)
apt-get install-y nodejs 

#查看安装成功后的版本
nodejs-v #v6.13.1

 #安装nodejs, NPM will be installed; (Npm:nodejs package management)
npm-version #3.10.10
2. Installing truffle
SUDO-E npm Install truffle-g
Truffle version #truffle @4.1.3, there is a problem with this version, the solution is provided later
3. Installing TESTRPC
SUDO-E npm Install ethereumjs-testrpc-g 
testrpc-v
4. Deploy and test the truffle default project
Truffle init
Truffle compile
Before deploying the contract: (1) Modify the Truffle.js file under the project directory as follows:
Module.exports = {
    networks: {
        development: {
            host: "localhost",
            port:8545,
            network_id: "*"// Match any network ID
         }}}
;
(2) Start rpctest

Before you can deploy a contract, start the service by modifying the above content:

Truffle migrate
Truffle serve
Service start times wrong: Typeerror:fsevents is not a constructor


Solution, reduce version to truffle@3.4.5:

NPM uninstall-g Truffle npm install-g truffle@3.4.5 #之前安装的truffle @4.1.3 version, lowered to Truffle@3.4.5mkdir truffle-webpack CD Truf Fle-webpack Truffle init webpack truffle compile npm run dev #替代truffle serve

The above scenario will still cause an error:

The ultimate Solution:

NPM uninstall-g Truffle
npm config set registry https://registry.npm.taobao.org
sudo-e npm install truffle@2.0. 8-g  
Reference: http://blog.csdn.net/vinsuan1993/article/details/77427537


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.