aragon / hack

(Aragon 1) Content and source code for the Aragon Developer Portal
https://hack.aragon.org
Creative Commons Zero v1.0 Universal
31 stars 37 forks source link

Issues following example #199

Closed okwme closed 4 years ago

okwme commented 4 years ago

Hello, I recently went through the tutorial here: https://hack.aragon.org/docs/tutorial.html and ran into a few issues along the way. I'm running Ubuntu 18 which I've found to be the root of similar errors in the past but didn't investigate too deeply. I found ways to get around all of the errors but thought you might want to investigate them for a tutorial flow that doesn't involve troubleshooting.

The first one occurred with the command npx create-aragon-app foo.aragonpm.eth tutorial. I received the error that the aragon command was missing. To fix this I installed it globally using npm install -g @aragon/cli. The command worked afterwards.

The second error I encountered was with the command npx aragon run --files dist. The error I received was: Cannot find the ipfs dependency. Has this module installed correctly?. I tried running the command like aragon run --files dist since I previously installed the aragon command globally and I received no error.

The third error I received occurred within the app after I launched the test demo as follows: aragon run --files dist. I get all the checkmarks as so:

> aragon run --files dist
  ✔ Check port
  ✔ Start a local Ethereum network
  ✔ Start a local Ethereum network
  ✔ Start a local Ethereum network
  ✔ Check IPFS
  ✔ Setup before publish
  ✔ Prepare for publish
  ✔ Publish app to aragonPM
  ✔ Fetch published repo
  ✔ Create DAO
  ✔ Open DAO

ℹ You are now ready to open your app in Aragon.

ℹ Here are some Ethereum accounts you can use.
  The first one will be used for all the actions the aragonCLI performs.
  You can use your favorite Ethereum provider or wallet to import their private keys.

Address #1:  0xb4124cEB3451635DAcedd11767f004d8a28c6eE7 (account used to deploy DAOs, has more permissions)
Private key: a8a54b2d8197bc0b19bb8a084031be71835580a01e70a45a13babd16c9bc1563

Address #2:  0x8401Eb5ff34cc943f096A32EF3d5113FEbE8D4Eb 
Private key: ce8e3bda3b44269c147747a373646393b1504bfcbb73fc9564f5d753d8116608

ℹ The accounts were generated from the following mnemonic phrase:
explain tackle mirror kit van hammer degree position ginger unfair soup bonus

ℹ This is the configuration for your development deployment:
    Ethereum Node: ws://localhost:8545
    ENS registry: 0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1
    aragonPM registry: aragonpm.eth
    DAO address: 0xD20F21CEb31a8E302603dC3ff994f00aa9312A66

ℹ Opening http://localhost:3000/#/0xD20F21CEb31a8E302603dC3ff994f00aa9312A66 to view your DAO

However, when I visit the app in the browser I receive this error on the screen:

ipfs resolve -r /ipfs/QmYevZ8qGZ2CX292atjX847T7Y2y5ePpLEVREa1pV1b8zB/dist/index.html: no link named "dist" under QmYevZ8qGZ2CX292atjX847T7Y2y5ePpLEVREa1pV1b8zB

If i go to the referenced IPFS file directly like http://localhost:8080/ipfs/QmYevZ8qGZ2CX292atjX847T7Y2y5ePpLEVREa1pV1b8zB/dist/index.html I see the same error. However, if I remove the file path and just visit http://localhost:8080/ipfs/QmYevZ8qGZ2CX292atjX847T7Y2y5ePpLEVREa1pV1b8zB/ I am presented with the index.html file fully rendered.

When I run the app without the dist flag like: aragon run I am presented with a properly rendered demo app. However, in the console are the following errors:

inpage.js:1 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://localhost:8080') does not match the recipient window's origin ('null').
...
contentscript.js:1 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://localhost:8080') does not match the recipient window's origin ('null').

With regard to the final configuration with the buld scripts split into two, the first command npm run start:app seems to work. However the second one, npm run start:aragon:http throws the error:

Cannot find the ipfs dependency. Has this module installed correctly?

When I remove the npx from the beginning of the command like earlier I get this error:

/home/billy/GitHub.com/bin-studio/membership/node_modules/@aragon/cli/src/util.js:92
  throw new Error(
        ^
Error: Cannot find the ipfs dependency. Has this module installed correctly?
...

Not sure if the tutorial is just out of date or if there is anything relevant to the way Ubuntu references NPM packages that would result in this behavior but thought you'd like to know. Thanks for an otherwise pleasant tutorial : )

macor161 commented 4 years ago

Hi @okwme , thanks for submitting this issue. The tutorial and template are indeed a little bit outdated right now, I submitted patches (#200 and https://github.com/aragon/your-first-aragon-app/pull/11) to fix this. Basically, there are 3 things that need to be changed:

  1. Like you discovered, the @aragon/cli dependency needs to be upgraded to the latest version.
  2. It may be necessary to run aragon ipfs install to install and setup IFS the first time you use the CLI.
  3. And lastly, the content of the manifest.json file should now be:
    {
    "name": "Counter",
    "description": "My first Aragon app",
    "script": "/script.js",
    "start_url": "/index.html"
    }

    (no more /dist/) Hope this will fix your problems 🙂

okwme commented 4 years ago

thank you!!!