Unable to serve on http://localhost:8080
Hi,
When I run ethers-build serve, it doesn’t server on the localhost:8080 instead only on the testnet sites – see below:
—-
serving content from file:///Users/username/blockgeeks/3_decentralisedApps/explorerapp
Listening on port: 8080
Local Application Test URL:
mainnet: http://ethers.io/#!/app-link-insecure/localhost:8080/
ropsten: http://ropsten.ethers.io/#!/app-link-insecure/localhost:8080/
rinkeby: http://rinkeby.ethers.io/#!/app-link-insecure/localhost:8080/
kovan: http://kovan.ethers.io/#!/app-link-insecure/localhost:8080/
—
Can you please advise how to serve locally, I even tried enforcing –host as localhost and –port 8080 but couldn’t get it to work.
Pls help!
Thanks,
R
Hi Riya, ethers is serving your content locally but it wraps things inside its own container which contains a bunch of built in functionalities. Notices the links at the end has ‘localhost:8080’, for example the mainnet, ‘http://ethers.io/#!/app-link-insecure/localhost:8080/’. Once you load up that link, just click “enable insecure dapp” button and you should be able to see your custom html being loaded. Hope this helps.
Hey Riya, to add a bit more to Jack’s answer: all ethers apps run inside of an ethers “container”. There is an ethers container running at http://ethers.io for your convenience provided by the author of ethers, Richard Moore. See the developer docs for more details on this architecture: https://docs.ethers.io/ethers-app/html/dev-overview.html
But you can also access your app locally by visiting “http://localhost:8080/#!/app-link-insecure/localhost:8080/” (just replace ethers.io in the URL with localhost:8080). This will serve your app inside the locally running instance of the ethers container (instead of the container running at http://ethers.io)
I’m experiencing the same trouble as Riya. The HTML loads but fails to ethers.onready fails to load.
I also followed the ethers docs and changed the script to:
console.log(‘ethers getting ready…’); // this works
ethers.onready = function() {
console.log(‘ethers ready now!’); // this does not work
};
Hey Steven, are there any errors being printed in your browser console when you load the page? Also, have you included the ethers-app.js script in your HTML?
haseebrabbani, Here’s my terminal:
Here’s my HTML:
Using Chrome with MetaMask:When I open http://localhost:8080/_/#!/app-link-insecure/localhost:8080/, the page only shows the row headers. Nothing from ethers and the console displays: ethers getting ready…When I open http://ethers.io/#!/app-link-insecure/localhost:8080/, I click the Enable Insecure dApps button, the page shows the ethers header with MetaMask, the table row headers and the console displays:
In MetaMask, I created a new custom RPC URL with http://ethers.io/#!/app-link-insecure/localhost:8080/, but it is not able to connect. Same for localhost:8080.Using Firefox without MetaMask:When I open http://localhost:8080/_/#!/app-link-insecure/localhost:8080/, the page only shows the row headers. Nothing from ethers and the console displays:
When I open http://ethers.io/#!/app-link-insecure/localhost:8080/, I’m prompted to create a new account over a non-secure connection.Thanks
Hey Steven, I tested your provided HTML and found a syntax error: the end </title> tag is not correctly closed with a pointy bracket. When I fixed this, I was able to see the ‘ethers ready now!’ message. Please let us know if you have further issues