{"action":"opened","issue":{"url":"https://api.github.com/repos/polkadot-js/api/issues/215","repository_url":"https://api.github.com/repos/polkadot-js/api","labels_url":"https://api.github.com/repos/polkadot-js/api/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/polkadot-js/api/issues/215/comments","events_url":"https://api.github.com/repos/polkadot-js/api/issues/215/events","html_url":"https://github.com/polkadot-js/api/issues/215","id":367238271,"node_id":"MDU6SXNzdWUzNjcyMzgyNzE=","number":215,"title":"Unable to get examples to work when not following instructions","user":{"login":"ltfschoen","id":6226175,"node_id":"MDQ6VXNlcjYyMjYxNzU=","avatar_url":"https://avatars0.githubusercontent.com/u/6226175?v=4","gravatar_id":"","url":"https://api.github.com/users/ltfschoen","html_url":"https://github.com/ltfschoen","followers_url":"https://api.github.com/users/ltfschoen/followers","following_url":"https://api.github.com/users/ltfschoen/following{/other_user}","gists_url":"https://api.github.com/users/ltfschoen/gists{/gist_id}","starred_url":"https://api.github.com/users/ltfschoen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ltfschoen/subscriptions","organizations_url":"https://api.github.com/users/ltfschoen/orgs","repos_url":"https://api.github.com/users/ltfschoen/repos","events_url":"https://api.github.com/users/ltfschoen/events{/privacy}","received_events_url":"https://api.github.com/users/ltfschoen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-05T14:34:09Z","updated_at":"2018-10-05T14:34:09Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I can get all the examples to work if I follow the instructions in https://polkadot.js.org/api/examples/, by starting a Polkadot Node with `polkadot --dev`, and then in the folder of each example running `yarn; yarn run start`\r\n\r\nHowever, if I **\"do my own thing\"** to try the examples in a separate folder, I get errors. For example if I creating package.json `yarn init -y`. Adding all dependencies `yarn add bn.js @polkadot/api @polkadot/api-provider @polkadot/storage @polkadot/extrinsics -W`. Installing all dependences in node_modules with `yarn`. Start a Polkadot Node with `polkadot --dev`. And then copy/paste the code from each example into a test.js file and run it with `node test.js`.\r\n\r\nI can successfully get \"Simple Connect\" and \"Generate Accounts\" example code to work.\r\n\r\nHowever I get errors when I run the other examples as follows:\r\n* \"Listen to blocks\" example code as it just returns #0 (even thought it's already at block #180,000). \r\n* \"Listen to balance change\" example code, it returns error `TypeError: Cannot read property 'public' of undefined` (in relation to the argument that 's provided `storage.staking.public.freeBalanceOf`). \r\n* \"Read Storage\" example code returns error `TypeError: Cannot read property 'public' of undefined` (in relation to argument `storage.session.public.validators`).\r\n* \"Craft Extrinsic\" example code returns error `Error: Cannot find module '@polkadot/extrinsics/codec/encode'` (even after performing `yarn add @polkadot/extrinsics`).\r\n* \"Transfer DOTs\" example code returns error `Error: Cannot find module '@polkadot/extrinsics/codec/encode/uncheckedLength'\r\n`"}}
{"actor":{"display_login":"ltfschoen"}}