dappuniversity / ipfs_image_uploader

IPFS Image Uploads dApp With Ethereum Smart Contracts
92 stars 83 forks source link

how to get this run installly? npm install,then "truffle migrate --reset", then "npm run dev"? #2

Open Csyoung29 opened 5 years ago

Csyoung29 commented 5 years ago

$ truffle migrate --reset Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js.

Compiling your contracts...

Compiling .\contracts\Migrations.sol Compiling .\contracts\SimpleStorage.sol

compilation warnings encountered:

/D/ipfs_image_uploader-master/contracts/Migrations.sol:11:3: Warning: This declaration shadows an existing declaration. function Migrations() public { ^ (Relevant source part starts here and spans across multiple lines). /D/ipfs_image_uploader-master/contracts/Migrations.sol:3:1: The shadowed declaration is here: contract Migrations { ^ (Relevant source part starts here and spans across multiple lines).

Error: CompileError: /D/ipfs_image_uploader-master/contracts/Migrations.sol:11:3: SyntaxError: Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it. function Migrations() public { ^ (Relevant source part starts here and spans across multiple lines). ,/D/ipfs_image_uploader-master/contracts/Migrations.sol:20:5: TypeError: Name has to refer to a struct, enum or contract. Migrations upgraded = Migrations(new_address); ^--------^

Compilation failed. See above. at Object.compile (C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\legacy\index.js:72:1) Truffle v5.0.38 (core: 5.0.38) Node v10.16.0

Atik-Mujawar commented 2 years ago

I would like to contribute to this issue by stating the steps to successfully run this decentralized application of (ipfs_image_uploader) and also the code as per the updated versions. Step 1: Clone this repository to you system with the help of git clone command. Command - "git clone https://github.com/dappuniversity/ipfs_image_uploader.git " Step 2: Now to download all the dependencies of the project run this command. Command - "npm install" Step 3: After installing all the dependencies of the project now we have to compile the smart contract. Make sure you have your Ganache up and running. Step 4: Before compiling we have to make some changes in the 'truffle-config.js' file, we have to un comment the deployment code and put in the details of Ganache which you are using.

development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 7545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
    },

Step 5: After making this changes we have to go to truffle folder and run this command.

- Contracts: Compile:         cd truffle && truffle compile
- Contracts: Test:                cd truffle && truffle test
- Contracts: Migrate:         cd truffle && truffle migrate

Step 6: After successfully compiling the smart contract now we should the run the frontend of the application

- Dapp: Run dev server:         cd client && npm start
- Dapp: Test:                           cd client && npm test
- Dapp: Build for production: cd client && npm run build

By following all these commands your application will be up and running.