0

First, I install type to the code like npm install web3 in the terminal while the first issue occurs (Environment1).Second, I change the version of nodenpm (like Envirnment 1=> Environment2) and type to the same code npm install web3 is OK (version of web3 is 0.20.6 ). Last, when I invoke web3.eth.methods in my project(Environment2 ),I found the second issue is occuring that this.web3 is defined but the this.web3.eth.methods is undefined in despite of I configure the environment 2 through npm install web3 or yarn add web3 .

Environment1 system:Ubuntu16.04; node:8.9.0; npm:5.6.0;

Issue 1 as fellow the issue describe like /.npm/_cache/tmp/git-clone-da91fc96/.git:Permission denied enter image description here

Environment2 system:Ubuntu16.04; node: 6.11.0; npm: 3.11.0; web3: 0.20.6;

Issue 2 as fellow I type to the code like console.log(this.web3) in project and test through developer tool in Google ,the picture as fellow:

enter image description here

I invoke the contract through var Contract = new this.web3.eth.contract(artifacts.abi,'contract_address'); print the contract in project and test through developer tool in Google ,the picture as fellow:

enter image description here

And I invoke a method like getValue() is undefined and I type to the code console.log(window.escrowContract.methods); display the methods is undefined as fellow:

enter image description here

I don't know whether relationship has between two issue and I look through some articles and tutorials ,their methods don't work on me .And I know the version of web3 under the version1 (https://web3js.readthedocs.io/en/1.0/web3-eth.html) ,the method of invoke contract should be var Contract = new this.web3.eth.Contract(artifacts.abi,'contract_address'); .But a new issue occurs as fellow ,so I change the C into c .

enter image description here

What's the method can resolve it ?

  • I have resolved this problem through two codes as fellow: 1.npm cache clear --force 2.npm install web3 – Allen Kris Mar 25 '18 at 8:21
  • Explanation in my opinion as fellow: First, the first issue occurs because cache of npm is filled in my computer ,before I clear the cache of npm ,I operate the npm install web3 in root directory occurs issue .After I do that, the npm install web3 is OK. – Allen Kris Mar 25 '18 at 8:22
  • Sencond, before I operate 'npm install web3', I ever install web3 through 'yarn add web3', but after complete installation, issue2 occurs. I feel that install web3 through yarn is half-baked. From then on, I type to two code as I said, the two issues don't occur. These explanation only represent my opinion, I hope it's useful for you. – Allen Kris Mar 25 '18 at 8:22
0

I have resolved this problem through two codes as fellow: 1.npm cache clear --force 2.npm install web3

Explanation in my opinion as fellow: First, the first issue occurs because cache of npm is filled in my computer ,before I clear the cache of npm ,I operate the npm install web3 in root directory occurs issue .After I do that, the npm install web3 is OK. Sencond, before I operate 'npm install web3', I ever install web3 through 'yarn add web3', but after complete installation, issue2 occurs. I feel that install web3 through yarn is half-baked. From then on, I type to two code as I said, the two issues don't occur. These explanation only represent my opinion, I hope it's useful for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.