Git Product home page Git Product logo

create-react-dapp's Issues

Issue with Migrations

Hello,

I'm getting the following issues when running migrate:

`> cd dapp && truffle migrate --reset --compile-all

Compiling ./contracts/Migrations.sol...
Compiling ./contracts/Voting.sol...
Compiling ./lib/mortal.sol...
Compiling ./lib/owned.sol...

Compilation warnings encountered:

/Users/saraczyzewicz/Dev/slothio/dapp/lib/owned.sol:12:5: Warning: This declaration shadows an existing declaration.
function owned() public {
^ (Relevant source part starts here and spans across multiple lines).
/Users/saraczyzewicz/Dev/slothio/dapp/lib/owned.sol:3:1: The shadowed declaration is here:
contract owned {
^ (Relevant source part starts here and spans across multiple lines).

,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Migrations.sol:13:3: Warning: This declaration shadows an existing declaration.
function Migrations() public {
^ (Relevant source part starts here and spans across multiple lines).
/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Migrations.sol:5:1: The shadowed declaration is here:
contract Migrations is mortal {
^ (Relevant source part starts here and spans across multiple lines).

,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Voting.sol:11:3: Warning: This declaration shadows an existing declaration.
function Voting(bytes32[] candidateNames) public {
^ (Relevant source part starts here and spans across multiple lines).
/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Voting.sol:6:1: The shadowed declaration is here:
contract Voting is mortal {
^ (Relevant source part starts here and spans across multiple lines).

/Users/saraczyzewicz/Dev/slothio/dapp/lib/owned.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/saraczyzewicz/Dev/slothio/dapp/lib/owned.sol:12:5: 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 owned() public {
^ (Relevant source part starts here and spans across multiple lines).
,/Users/saraczyzewicz/Dev/slothio/dapp/lib/mortal.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Migrations.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Migrations.sol:13: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).
,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Voting.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.11;
^----------------------^
,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Voting.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 Voting(bytes32[] candidateNames) public {
^ (Relevant source part starts here and spans across multiple lines).
,/Users/saraczyzewicz/Dev/slothio/dapp/lib/owned.sol:12:5: Warning: This declaration shadows an existing declaration.
function owned() public {
^ (Relevant source part starts here and spans across multiple lines).
/Users/saraczyzewicz/Dev/slothio/dapp/lib/owned.sol:3:1: The shadowed declaration is here:
contract owned {
^ (Relevant source part starts here and spans across multiple lines).

,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Migrations.sol:13:3: Warning: This declaration shadows an existing declaration.
function Migrations() public {
^ (Relevant source part starts here and spans across multiple lines).
/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Migrations.sol:5:1: The shadowed declaration is here:
contract Migrations is mortal {
^ (Relevant source part starts here and spans across multiple lines).

,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Voting.sol:11:3: Warning: This declaration shadows an existing declaration.
function Voting(bytes32[] candidateNames) public {
^ (Relevant source part starts here and spans across multiple lines).
/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Voting.sol:6:1: The shadowed declaration is here:
contract Voting is mortal {
^ (Relevant source part starts here and spans across multiple lines).

,/Users/saraczyzewicz/Dev/slothio/dapp/contracts/Migrations.sol:22:5: TypeError: Name has to refer to a struct, enum or contract.
Migrations upgraded = Migrations(new_address);
^--------^
Compilation failed. See above.
Truffle v5.0.2 (core: 5.0.2)
Node v11.6.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ migrate: cd dapp && truffle migrate --reset --compile-all
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ migrate script.
npm ERR! This is probably not a problem with npm. There is likely additional log`


And the localhost page denotes 'Unhandled Rejection (Error): Couldn't find info file "contract-info/Voting.json". Perhaps you haven't run migrations for contract "Voting" yet, or the migrations aren't calling the "deployInfo" function.'

Please advise - thank you!

Support for Windows environments

When running npx create-react-dapp on Windows, the following error occurs.

=>  sandbox npx create-react-dapp create-react-dapp
npx: installed 1 in 4.322s
'"/bin/bash"' is not recognized as an internal or external command,
operable program or batch file.

Question: why use deployInfo script after migrations?

I have a bunch of questions around the migration process:

  • Why the need for the deployInfo.js script? Couldn't we have just copied the ABI files that truffle creates and use those?
  • Why not use truffle-contract package?
  • Why put the ABI files into the public folder rather than the src folder? This would avoid having to use axios to make multiple calls for the ABI files.

I mainly ask these questions because I'm interested to learn and potentially contribute to this project in the future. I have some ideas as to why the different decisions were made, but interested to hear what your actual reasons were.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.