truffle-box / pet-shop-box

A box containing all you need to get started with our Pet Shop tutorial.
MIT License
204 stars 144 forks source link

Click the "adopt" botton can't connect the transaction of wallet #18

Closed Huang9495 closed 5 years ago

Huang9495 commented 6 years ago

Reason:

Today, I do a test about how to create dapp named pet-shop-box follow the offcial tutorial . I am following the tutorial is here:http://truffleframework.com/tutorials/pet-shop.The issue is occuring after I operate until the commend npm run dev,html is occur,but when I click the "adopt" button ,the terminal and web happen nothing,and when I run npm run dev,the terminal is show the 304.

System:

OS: ubuntu-14.04 Truffle v4.0.3 (core: 4.0.3) Solidity v0.4.18 (solc-js)

Experiment

The First step: the code of truffle.js as fellow: module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // for more about customizing your Truffle configuration! networks: { development: { host: "localhost:", port: 8545, network_id: "*" // Match any network id } } }; the commend to launch ganache-cli as fellow:testrpc the current RPC of MetaMask as fellow:http://localhost:8545

The Second step: the code of truffle.js as fellow: module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // for more about customizing your Truffle configuration! networks: { development: { host: "localhost:", port: 9545, network_id: "*" // Match any network id } } }; the commend to launch ganache-cli as fellow:truffle develop the current RPC of MetaMask as fellow:http://localhost:9545

I have try the another port such 7545 and the host linke'172.0.0.1:port',but the issue still take place.And the develop tool of chorme is normal and no issue is remindered. But I type to console.log() in the app.js and observe the initcontract() is not work .So I don't know where the I should modify for this project? The picture of terminal is here: 1 The picture of web is here: 3

masanggil1986 commented 6 years ago

in the src/js/app.js file markAdopted function, please try this instead of hard coded adopter address.

if (parseInt(adopters[i], 16) < 1) {
     $('.panel-pet').eq(i).find('button').text('Success').attr('disabled', true);
}
Huang9495 commented 6 years ago

Hi! @masanggil1986 .It's isn't useful for me follow your tutorial.Nothing changed .

kyriediculous commented 6 years ago

Same issue App.contracts is an empty object.

kyriediculous commented 6 years ago

I named my contract Adoptions instead of Adoption but did this consistently throughout the tutorial. I get localhost:3000/Adoptions.json as I would expect but App.contracts is empty.

When I rename everything back to Adoption it works as normal.

Weird.

ri2rajsingh commented 6 years ago

It worked when i changed the below snippet

if (parseInt(adopters[i], 16) < 1) { $('.panel-pet').eq(i).find('button').text('Success').attr('disabled', true); } to if (parseInt(adopters[i]) > 1) { $('.panel-pet').eq(i).find('button').text('Success').attr('disabled', true);

0pay commented 6 years ago

Hi, I have followed all the pet -shop tutorial. Instead to use Ganache I have used "truffle develop". In the web3 code I inserted App.web3Provider = new web3.providers.HttpProvider('http://127.0.0.1:9545'); In MetaMask, I entered int the "New RPC URL" field the address "http://127.0.0.1:9545" The adopt button doesn't work. Would you please help me. thanks

@ri2rajsingh in which file there is the code you changed?

naveenkumarmarri commented 6 years ago

304 is non modified error. Can you try Empty cache and hard reload on chrome This trick worked for me

jaebooker commented 5 years ago

Has anyone been able to fix this issue? Can't find any solutions.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been closed, but can be re-opened if further comments indicate that the problem persists. Feel free to tag maintainers if there is no reply to further comments.