react-uport-box icon indicating copy to clipboard operation
react-uport-box copied to clipboard

Initializing Repo Instrucitons - Geth & Truffle

Open j0xhn opened this issue 7 years ago • 6 comments

I tried to get this repo up and running. I could get npm to install and run on my local machine but was given these errors when I tried to run the truffle compile / truffle migrate commands:

Error: Using 'babel-preset-react-app' requires that you specify 'NODE_ENV' or 'BABEL_ENV' environment variables. Valid values are "development", "test", and "production". Instead, received: undefined. (While processing preset: "/Users/john/Dev/projects/temp/truffle-box/node_modules/babel-preset-react-app/index.js")

I fixed this by adding the variable in front of my command:

NODE_ENV=test truffle compile
NODE_ENV=test truffle migrate

Then I got this error:

Error: Invalid JSON RPC response: "Error: connect ECONNREFUSED 127.0.0.1:8545\n    at Object.exports._errnoException (util.js:1022:11)\n    at exports._exceptionWithHostPort (util.js:1045:20)\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)"

So I opened up another terminal, opened a geth console, and executed this command to get it working:

geth console
admin.startRPC("127.0.0.1", 8545, "*", "web3,db,net,eth")

After that, the compile worked just fine but the migration did not. I got this error:

                 ^
ReferenceError: artifacts is not defined```

This however, I'm not sure what the intention is.  I can re-map it to ./contracts/Migrations.sol and the same for the SimpleStore.sol file, but not sure what artifacts is, and the metacoin file also includes a missing a wrong "./MetaCoin.sol" when I believe you're really trying to reach the ./TestMetacoin.sol file.  Not sure if the intention is to use https://github.com/trufflesuite/truffle-artifactor... just looking for some clarification.  I've included a pull request here (https://github.com/truffle-box/truffle-box-uport/pull/4) to fix some of these issues, but not exactly sure where to go in order to resolve all the artifact stuff.  

j0xhn avatar Apr 03 '17 06:04 j0xhn

Try to use an nvm version > 6

rinaldorossi avatar Apr 05 '17 16:04 rinaldorossi

@rinaldorossi Thanks for getting back to me. I tried nvm version and node -v and they both gave me v7.4.0 - What am I supposed to be seeing as a difference in my code by having nvm > 6?

Also there are pointers to .sol files that have been moved like var Migrations = require("../contracts/Migrations.sol"); instead of var Migrations = artifacts.require("./Migrations.sol");

How is that supposed to work anyways with the artifacts.require placed at the top of the page? In that file artifacts is treated like a global variable. Where is it put on the global namespace? The only artifact related npm that I could find was truffle-artifactor -- is that supposed to be present in my node_modules? I found ether-pudding, but the APIs for the two didn't seem to match up completely.

I apologize now if my arrogance is annoying you, just trying to make sense of this stuff and get it working. Thanks for your time, I appreciate your help.

j0xhn avatar Apr 05 '17 19:04 j0xhn

Could you share your repo?

rinaldorossi avatar Apr 06 '17 07:04 rinaldorossi

My branch is a fork: https://github.com/johndangerstorey/truffle-box-uport and I have a PR here: https://github.com/truffle-box/truffle-box-uport/pull/4

j0xhn avatar Apr 06 '17 14:04 j0xhn

@johndangerstorey Still having difficulties? Prior to running the RPC with Geth, was ethereumjs-testrpc not working?

OnlyOneJMJQ avatar Jul 10 '17 20:07 OnlyOneJMJQ

@DiscRiskandBisque I haven't tried recently. I can try again in a bit though and let ya know. If my memory serves me, I think I figured out the issue before was because all my "artifacts" errors came from me not installing truffle globally.... but again, that was months ago, so I'm not certain. If I have more issues I'll let you know.

j0xhn avatar Jul 11 '17 11:07 j0xhn